Merge pull request #3536 from LibreELEC/amlogic

Add Amlogic (mainline) project
This commit is contained in:
CvH 2019-06-13 23:06:16 +02:00 committed by GitHub
commit 2825c30f92
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
81 changed files with 58970 additions and 1 deletions

View File

@ -13,6 +13,12 @@ PKG_LONGDESC="Mesa is a 3-D graphics library with an API."
PKG_TOOLCHAIN="meson"
PKG_BUILD_FLAGS="+lto"
if listcontains "${GRAPHIC_DRIVERS}" "(lima|panfrost)"; then
PKG_VERSION="659aa3dd6519f64379e91ca97fe184434fd7fdee" # master-19.2
PKG_SHA256="7152dd8c780e47c4e5e18ebaa47fd4f8fe116b43012affda2f964ae23b324d34"
PKG_URL="https://gitlab.freedesktop.org/mesa/mesa/-/archive/$PKG_VERSION/mesa-$PKG_VERSION.tar.gz"
fi
get_graphicdrivers
PKG_MESON_OPTS_TARGET="-Ddri-drivers=${DRI_DRIVERS// /,} \
@ -90,6 +96,21 @@ pre_configure_target() {
if [ "$DISPLAYSERVER" = "x11" ]; then
export LIBS="-lxcb-dri3 -lxcb-dri2 -lxcb-xfixes -lxcb-present -lxcb-sync -lxshmfence -lz"
fi
# Temporary hack (until panfrost evolves) to use 64-bit pointers in structs passed to GPU
# even if userspace is 32-bit. This is required for Mali-T8xx to work with mesa built for
# arm userspace. The hack does not affect building for aarch64.
if [[ "${MALI_FAMILY}" = *t8* ]]; then
(
cd "$PKG_BUILD/src/gallium/drivers/panfrost"
sed -i 's/uintptr_t/uint64_t/g' include/panfrost-job.h \
include/panfrost-misc.h \
pan_context.c \
pandecode/decode.c
find -type f -exec sed -i 's/ndef __LP64__/ 0/g; s/def __LP64__/ 1/g' {} +;
)
fi
}
post_makeinstall_target() {

View File

@ -0,0 +1,33 @@
# SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2019-present Team LibreELEC (https://libreelec.tv)
PKG_NAME="mali-bifrost"
PKG_VERSION="79755036ecadecff0963cb55537d361708618122" # BX301A01B-SW-99002-r16p0-01rel0_meson-g12b
PKG_SHA256="f3d7ea0cc3a0fc215274c19ca3068f0ca0094206663497147906cde8f3671232"
PKG_ARCH="arm aarch64"
PKG_LICENSE="GPL"
PKG_SITE="https://developer.arm.com/products/software/mali-drivers/bifrost-kernel"
PKG_URL="https://github.com/LibreELEC/mali-bifrost/archive/$PKG_VERSION.tar.gz"
PKG_DEPENDS_TARGET="toolchain linux"
PKG_NEED_UNPACK="$LINUX_DEPENDS"
PKG_LONGDESC="mali-midgard: the Linux kernel driver for ARM Mali Midgard GPUs"
PKG_TOOLCHAIN="manual"
PKG_IS_KERNEL_PKG="yes"
case $PROJECT in
Amlogic)
PKG_MALI_PLATFORM_CONFIG="config.meson-g12a"
;;
esac
make_target() {
kernel_make KDIR=$(kernel_path) -C $PKG_BUILD \
CONFIG_NAME=$PKG_MALI_PLATFORM_CONFIG
}
makeinstall_target() {
DRIVER_DIR=$PKG_BUILD/driver/product/kernel/drivers/gpu/arm/midgard/
mkdir -p $INSTALL/$(get_full_module_dir)/$PKG_NAME
cp $DRIVER_DIR/mali_kbase.ko $INSTALL/$(get_full_module_dir)/$PKG_NAME/
}

View File

@ -0,0 +1 @@
meson/*

View File

@ -0,0 +1,43 @@
# SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv)
PKG_NAME="meson-firmware"
PKG_VERSION="edd24b481293b93814494508cd4952b67f15acb3"
PKG_SHA256="2092c71a5eb106725784dadcc2cfea7be60254539a41fafebf311235283259e4"
PKG_LICENSE="GPLv2"
PKG_SITE="https://github.com/LibreELEC/meson-firmware"
PKG_URL="https://github.com/LibreELEC/meson-firmware/archive/$PKG_VERSION.tar.gz"
PKG_DEPENDS_TARGET="toolchain"
PKG_LONGDESC="meson-firmware: Amlogic microcode firmware for the V4L2 mem2mem vdec driver"
PKG_TOOLCHAIN="manual"
makeinstall_target() {
FW_TARGET_DIR=$INSTALL/$(get_full_firmware_dir)
if find_file_path config/$PKG_NAME.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
for fwfile in $(cd ${PKG_BUILD} && eval "find ${fwline}"); 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
done < ${fwlist}
done
}

View File

@ -126,6 +126,7 @@ makeinstall_target() {
cp $PKG_DIR/scripts/createlog $INSTALL/usr/bin/
cp $PKG_DIR/scripts/dtfile $INSTALL/usr/bin
cp $PKG_DIR/scripts/dtname $INSTALL/usr/bin
cp $PKG_DIR/scripts/dtsoc $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/sudo $INSTALL/usr/bin/

View File

@ -0,0 +1,11 @@
#!/bin/bash
# SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv)
COMPATIBLE=$(cat /proc/device-tree/compatible 2>/dev/null | tr -d '\000' | sed -n -e 's/.*\(allwinner\|amlogic\|rockchip\).*/\1/p')
if [ -n "$COMPATIBLE" ]; then
DTNAME=$(cat /proc/device-tree/compatible | cut -f1,2 -d',' | tail -n 1)
echo "$DTNAME"
fi

View File

@ -99,7 +99,7 @@ post_makeinstall_target() {
# table for Xbox DVD Playback Kit
* rc-xbox-dvd xbox_dvd
# multi-table for amlogic devices
meson-ir * libreelec_multi
meson-ir rc-empty libreelec_multi
EOF
fi

View File

@ -17,6 +17,12 @@ PKG_STAMP="$UBOOT_SYSTEM"
PKG_NEED_UNPACK="$PROJECT_DIR/$PROJECT/bootloader"
[ -n "$DEVICE" ] && PKG_NEED_UNPACK+=" $PROJECT_DIR/$PROJECT/devices/$DEVICE/bootloader"
case "$PROJECT" in
Amlogic)
PKG_DEPENDS_TARGET+=" amlogic-boot-fip"
;;
esac
case "$PROJECT" in
Rockchip)
PKG_VERSION="8659d08d2b589693d121c1298484e861b7dafc4f"

View File

@ -0,0 +1,16 @@
# Amlogic
This project is for Amlogic SoC devices
## Links
* http://linux-meson.com
## Useful debug commands
* `cat /sys/kernel/debug/cec/cec0/status`
* `cat /sys/kernel/debug/clk/clk_summary`
* `cat /sys/class/drm/card0-HDMI-A-1/status`
* `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`

View File

@ -0,0 +1,7 @@
WETEK-UBOOT-CONFIG
# This is a helper file for WeTek Hub and Play2 devices.
# It is not used and safe to delete on every other device.
fatload mmc 0 1020000 s905_autoscript
autoscr 1020000

View File

@ -0,0 +1,19 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2019-present Team LibreELEC (https://libreelec.tv)
# detect legacy kernel installs and abort to prevent upgrades
if [ "$(uname -r)" = "3.14.29" ]; then
echo "Update from 3.14 is not supported!"
sleep 10
exit 1
fi
# allow upgrades between aarch64 and arm images
PROJECT=$("$1" | cut -d. -f1)
if [ "$1" = "${PROJECT}.aarch64" -o "$1" = "${PROJECT}.arm" ]; then
exit 0
else
exit 1
fi

View File

@ -0,0 +1,3 @@
CONFIG_LZ4=y
CONFIG_LZO=y
CONFIG_LZMA=y

View File

@ -0,0 +1,123 @@
# SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2019-present Team LibreELEC (https://libreelec.tv)
echo "$BOOTLOADER: creating u-boot.bin"
DESTDIR="$PKG_BUILD/fip"
mkdir -p $DESTDIR
FIPDIR="$(get_build_dir amlogic-boot-fip)"
case "${UBOOT_SYSTEM}" in
box|"")
# No-op, use vendor booloader
;;
odroid-c2)
FIPDIR+="/fip"
FUSEDIR="$(get_build_dir amlogic-boot-fip)/sd_fuse"
$FIPDIR/fip_create --bl30 $FIPDIR/gxb/bl30.bin \
--bl301 $FIPDIR/gxb/bl301.bin \
--bl31 $FIPDIR/gxb/bl31.bin \
--bl33 $(get_build_dir $BOOTLOADER)/u-boot.bin $DESTDIR/fip.bin
$FIPDIR/fip_create --dump $DESTDIR/fip.bin
cat $FIPDIR/gxb/bl2.package $DESTDIR/fip.bin > $DESTDIR/boot_new.bin
$FIPDIR/gxb/aml_encrypt_gxb --bootsig --input $DESTDIR/boot_new.bin --output $DESTDIR/u-boot.img
dd if=$DESTDIR/u-boot.img of=$DESTDIR/u-boot.gxbb bs=512 skip=96
dd if=$FUSEDIR/bl1.bin.hardkernel of=$DESTDIR/u-boot.bin.sd.bin conv=fsync,notrunc bs=1 count=442
dd if=$FUSEDIR/bl1.bin.hardkernel of=$DESTDIR/u-boot.bin.sd.bin conv=fsync,notrunc bs=512 skip=1 seek=1
dd if=$DESTDIR/u-boot.gxbb of=$DESTDIR/u-boot.bin.sd.bin conv=fsync,notrunc bs=512 seek=97
;;
nanopi-k2)
cp $FIPDIR/gxb/bl2.bin $DESTDIR/
cp $FIPDIR/gxb/acs.bin $DESTDIR/
cp $FIPDIR/gxb/bl21.bin $DESTDIR/
cp $FIPDIR/gxb/bl30.bin $DESTDIR/
cp $FIPDIR/gxb/bl301.bin $DESTDIR/
cp $FIPDIR/gxb/bl31.img $DESTDIR/
cp $(get_build_dir $BOOTLOADER)/u-boot.bin $DESTDIR/bl33.bin
$FIPDIR/blx_fix.sh $DESTDIR/bl30.bin \
$DESTDIR/zero_tmp \
$DESTDIR/bl30_zero.bin \
$DESTDIR/bl301.bin \
$DESTDIR/bl301_zero.bin \
$DESTDIR/bl30_new.bin bl30
$FIPDIR/fip_create --bl30 $DESTDIR/bl30_new.bin \
--bl31 $DESTDIR/bl31.img \
--bl33 $DESTDIR/bl33.bin \
$DESTDIR/fip.bin
$FIPDIR/fip_create --dump $DESTDIR/fip.bin
python2 $FIPDIR/acs_tool.pyc $DESTDIR/bl2.bin \
$DESTDIR/bl2_acs.bin \
$DESTDIR/acs.bin 0
$FIPDIR/blx_fix.sh $DESTDIR/bl2_acs.bin \
$DESTDIR/zero_tmp \
$DESTDIR/bl2_zero.bin \
$DESTDIR/bl21.bin \
$DESTDIR/bl21_zero.bin \
$DESTDIR/bl2_new.bin bl2
cat $DESTDIR/bl2_new.bin $DESTDIR/fip.bin > $DESTDIR/boot_new.bin
$FIPDIR/gxb/aml_encrypt_gxb --bootsig --input $DESTDIR/boot_new.bin --output $DESTDIR/u-boot.bin.sd.bin
;;
*)
cp $FIPDIR/gxl/bl2.bin $DESTDIR/
cp $FIPDIR/gxl/acs.bin $DESTDIR/
cp $FIPDIR/gxl/bl21.bin $DESTDIR/
cp $FIPDIR/gxl/bl30.bin $DESTDIR/
cp $FIPDIR/gxl/bl301.bin $DESTDIR/
cp $FIPDIR/gxl/bl31.img $DESTDIR/
cp $(get_build_dir $BOOTLOADER)/u-boot.bin $DESTDIR/bl33.bin
$FIPDIR/blx_fix.sh $DESTDIR/bl30.bin \
$DESTDIR/zero_tmp \
$DESTDIR/bl30_zero.bin \
$DESTDIR/bl301.bin \
$DESTDIR/bl301_zero.bin \
$DESTDIR/bl30_new.bin bl30
python2 $FIPDIR/acs_tool.pyc $DESTDIR/bl2.bin $DESTDIR/bl2_acs.bin $DESTDIR/acs.bin 0
$FIPDIR/blx_fix.sh $DESTDIR/bl2_acs.bin \
$DESTDIR/zero_tmp \
$DESTDIR/bl2_zero.bin \
$DESTDIR/bl21.bin \
$DESTDIR/bl21_zero.bin \
$DESTDIR/bl2_new.bin bl2
$FIPDIR/gxl/aml_encrypt_gxl --bl3enc --input $DESTDIR/bl30_new.bin
$FIPDIR/gxl/aml_encrypt_gxl --bl3enc --input $DESTDIR/bl31.img
$FIPDIR/gxl/aml_encrypt_gxl --bl3enc --input $DESTDIR/bl33.bin
$FIPDIR/gxl/aml_encrypt_gxl --bl2sig --input $DESTDIR/bl2_new.bin --output $DESTDIR/bl2.n.bin.sig
$FIPDIR/gxl/aml_encrypt_gxl --bootmk --output $DESTDIR/u-boot.bin.sd.bin --bl2 $DESTDIR/bl2.n.bin.sig --bl30 $DESTDIR/bl30_new.bin.enc --bl31 $DESTDIR/bl31.img.enc --bl33 $DESTDIR/bl33.bin.enc
;;
esac
# Clean up after previous build
rm -rf $INSTALL/usr/share/bootloader/boot.ini
rm -rf $INSTALL/usr/share/bootloader/u-boot.bin.sd.bin
mkdir -p $INSTALL/usr/share/bootloader
if [ -f $DESTDIR/u-boot.bin.sd.bin ] ; then
cp -av $DESTDIR/u-boot.bin.sd.bin $INSTALL/usr/share/bootloader
fi
# Install boot.ini if it exists
if find_file_path bootloader/${UBOOT_SYSTEM}.ini; then
cp -av ${FOUND_PATH} $INSTALL/usr/share/bootloader/boot.ini
fi

View File

@ -0,0 +1,30 @@
# SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2019-present Team LibreELEC (https://libreelec.tv)
. config/options $1
case "${UBOOT_SYSTEM}" in
box|"")
DTB="@@DTB_NAME@@"
;;
*)
echo "image: writing u-boot to $(basename $DISK)"
dd if="$INSTALL/usr/share/bootloader/u-boot.bin.sd.bin" of="$DISK" conv=fsync,notrunc bs=1 count=112 >"$SAVE_ERROR" 2>&1 || show_error
dd if="$INSTALL/usr/share/bootloader/u-boot.bin.sd.bin" of="$DISK" conv=fsync,notrunc bs=512 skip=1 seek=1 >"$SAVE_ERROR" 2>&1 || show_error
DTB="$(${SCRIPTS}/uboot_helper ${PROJECT} ${DEVICE} ${UBOOT_SYSTEM} dtb)"
;;
esac
echo "image: creating uEnv.ini"
cat << EOF > "${LE_TMP}/uEnv.ini"
dtb_name=/dtb/${DTB}
bootargs=boot=UUID=${UUID_SYSTEM} disk=UUID=${UUID_STORAGE} quiet ${EXTRA_CMDLINE}
EOF
mcopy -s "${LE_TMP}/uEnv.ini" ::
touch "$RELEASE_DIR/3rdparty/bootloader/aml_autoscript.zip"
echo "image: copying autoscript files and device trees"
mcopy -s ${RELEASE_DIR}/3rdparty/bootloader/* ::

View File

@ -0,0 +1,25 @@
# SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2019-present Team LibreELEC (https://libreelec.tv)
mkdir -p "$RELEASE_DIR/3rdparty/bootloader"
cp -a $(get_build_dir u-boot-script)/* $RELEASE_DIR/3rdparty/bootloader
if find_file_path bootloader/${UBOOT_SYSTEM}.ini; then
cp -av ${FOUND_PATH} $RELEASE_DIR/3rdparty/bootloader/boot.ini
fi
mkdir -p "$RELEASE_DIR/3rdparty/bootloader/dtb"
case ${DEVICE:-$PROJECT} in
AMLGX)
cp -a $(get_build_dir linux)/arch/$TARGET_KERNEL_ARCH/boot/dts/amlogic/*gxbb*.dtb $RELEASE_DIR/3rdparty/bootloader/dtb
cp -a $(get_build_dir linux)/arch/$TARGET_KERNEL_ARCH/boot/dts/amlogic/*gxl*.dtb $RELEASE_DIR/3rdparty/bootloader/dtb
cp -a $(get_build_dir linux)/arch/$TARGET_KERNEL_ARCH/boot/dts/amlogic/*gxm*.dtb $RELEASE_DIR/3rdparty/bootloader/dtb
;;
AMLG12)
cp -a $(get_build_dir linux)/arch/$TARGET_KERNEL_ARCH/boot/dts/amlogic/*g12a*.dtb $RELEASE_DIR/3rdparty/bootloader/dtb
cp -a $(get_build_dir linux)/arch/$TARGET_KERNEL_ARCH/boot/dts/amlogic/*g12b*.dtb $RELEASE_DIR/3rdparty/bootloader/dtb
;;
*)
cp -a $(get_build_dir linux)/arch/$TARGET_KERNEL_ARCH/boot/dts/amlogic/*.dtb $RELEASE_DIR/3rdparty/bootloader/dtb
;;
esac

View File

@ -0,0 +1,40 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2018-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 '})
# identify the boot device
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 rw
mount -o remount,rw $BOOT_ROOT
# update device trees
for dtbfile in $BOOT_ROOT/dtb/*.dtb ; do
dtb=$(basename $dtbfile)
echo "Updating $dtb"
cp -p $SYSTEM_ROOT/usr/share/bootloader/$dtb $BOOT_ROOT/dtb/ 2>/dev/null || true
done
# update u-boot scripts
for scriptfile in $SYSTEM_ROOT/usr/share/bootloader/*_autoscript* $SYSTEM_ROOT/usr/share/bootloader/*.scr ; do
echo "Updating $(basename $scriptfile)"
cp -p $scriptfile $BOOT_ROOT 2>/dev/null || true
done
# mount $BOOT_ROOT ro
sync
mount -o remount,ro $BOOT_ROOT

View File

@ -0,0 +1 @@
../AMLGX/bootloader

View File

@ -0,0 +1,52 @@
################################################################################
# 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+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
# Kernel target
KERNEL_TARGET="uImage.lzo"
# Kernel uImage load address
KERNEL_UIMAGE_LOADADDR="0x1080000"
# Kernel uImage entry address
KERNEL_UIMAGE_ENTRYADDR="0x1080000"
# Additional kernel make parameters
KERNEL_MAKE_EXTRACMD="dtbs"
# kernel serial console
EXTRA_CMDLINE="console=ttyAML0,115200n8 console=tty0"
# OpenGL-ES implementation to use
OPENGLES="libmali"
# Graphic drivers to use
GRAPHIC_DRIVERS=""
# KODI Player implementation to use
KODIPLAYER_DRIVER="$OPENGLES"
# Mali GPU family
MALI_FAMILY="g31 g52"
# additional drivers to install
ADDITIONAL_DRIVERS+=" mali-bifrost"

View File

@ -0,0 +1,11 @@
defenv
setenv bootcmd 'run start_autoscript; run storeboot'
setenv start_autoscript 'mmcinfo && run start_mmc_autoscript; usb start && run start_usb_autoscript; run start_emmc_autoscript'
setenv start_emmc_autoscript 'fatload mmc 1 1020000 emmc_autoscript && autoscr 1020000'
setenv start_mmc_autoscript 'fatload mmc 0 1020000 s905_autoscript && autoscr 1020000'
setenv start_usb_autoscript 'for usbdev in 0 1 2 3; do fatload usb ${usbdev} 1020000 s905_autoscript && autoscr 1020000; done'
setenv system_part b
setenv upgrade_step 2
saveenv
sleep 1
reboot

View File

@ -0,0 +1,4 @@
load ${devtype} ${devnum}:${distro_bootpart} ${kernel_addr_r} ${prefix}uEnv.ini && env import -t ${kernel_addr_r} ${filesize}
load ${devtype} ${devnum}:${distro_bootpart} ${kernel_addr_r} ${prefix}KERNEL
load ${devtype} ${devnum}:${distro_bootpart} ${fdt_addr_r} ${dtb_name}
bootm ${kernel_addr_r} - ${fdt_addr_r}

View File

@ -0,0 +1,7 @@
setenv env_addr 0x10400000
setenv boot_start 'bootm ${loadaddr} - ${dtb_mem_addr}'
setenv addmac 'if printenv mac; then setenv bootargs ${bootargs} mac=${mac}; elif printenv eth_mac; then setenv bootargs ${bootargs} mac=${eth_mac}; fi'
setenv try_boot_start 'if fatload ${devtype} ${devnum} ${loadaddr} KERNEL; then fatload ${devtype} ${devnum} ${env_addr} uEnv.ini && env import -t ${env_addr} ${filesize} && run addmac; fatload ${devtype} ${devnum} ${dtb_mem_addr} ${dtb_name} && run boot_start; fi'
setenv devtype mmc
setenv devnum 1
run try_boot_start

View File

@ -0,0 +1,9 @@
setenv env_addr 0x10400000
setenv boot_start 'bootm ${loadaddr} - ${dtb_mem_addr}'
setenv addmac 'if printenv mac; then setenv bootargs ${bootargs} mac=${mac}; elif printenv eth_mac; then setenv bootargs ${bootargs} mac=${eth_mac}; fi'
setenv try_boot_start 'if fatload ${devtype} ${devnum} ${loadaddr} KERNEL; then fatload ${devtype} ${devnum} ${env_addr} uEnv.ini && env import -t ${env_addr} ${filesize} && run addmac; fatload ${devtype} ${devnum} ${dtb_mem_addr} ${dtb_name} && run boot_start; fi'
setenv devtype mmc
setenv devnum 0
run try_boot_start
setenv devtype usb
for devnum in 0 1 2 3 ; run try_boot_start ; done

View File

@ -0,0 +1,49 @@
################################################################################
# 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+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
# Kernel target
KERNEL_TARGET="uImage.lzo"
# Kernel uImage load address
KERNEL_UIMAGE_LOADADDR="0x1080000"
# Kernel uImage entry address
KERNEL_UIMAGE_ENTRYADDR="0x1080000"
# Additional kernel make parameters
KERNEL_MAKE_EXTRACMD="dtbs"
# kernel serial console
EXTRA_CMDLINE="console=ttyAML0,115200n8 console=tty0"
# OpenGL-ES implementation to use
OPENGLES="mesa"
# Graphic drivers to use
GRAPHIC_DRIVERS="lima panfrost"
# KODI Player implementation to use
KODIPLAYER_DRIVER="$OPENGLES"
# Mali GPU family
MALI_FAMILY="450 t820"

View File

@ -0,0 +1,8 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv)
TEMP=$(cat /sys/class/hwmon/hwmon0/temp1_input)
TEMP="$(( $TEMP / 1000 ))"
echo "${TEMP} C"

View File

@ -0,0 +1 @@
cputemp

View File

@ -0,0 +1,34 @@
#
# Configuration for HDMI
#
<confdir:pcm/hdmi.conf>
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
}

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8" ?>
<settings version="1">
<section id="system">
<category id="display">
<group id="1">
<setting id="videoscreen.screenmode">
<visible>true</visible>
<default>0192001080060.00000pstd</default>
</setting>
<setting id="videoscreen.limitedrange">
<visible>false</visible>
</setting>
<setting id="videoscreen.limitguisize">
<visible>true</visible>
<default>3</default>
</setting>
</group>
</category>
</section>
</settings>

File diff suppressed because it is too large Load Diff

67
projects/Amlogic/options Normal file
View File

@ -0,0 +1,67 @@
################################################################################
# setup system defaults
################################################################################
# Bootloader to use (syslinux / u-boot / bcm2835-bootloader)
BOOTLOADER="u-boot"
# Linux Kernel to use
LINUX="default"
################################################################################
# setup build defaults
################################################################################
# Project CFLAGS
PROJECT_CFLAGS=""
# SquashFS compression method (gzip / lzo / xz / zstd)
SQUASHFS_COMPRESSION="zstd"
################################################################################
# setup project defaults
################################################################################
# build and install ALSA Audio support (yes / no)
ALSA_SUPPORT="yes"
# OpenGL(X) implementation to use (no / mesa)
OPENGL="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=""
# additional Firmware to use (dvb-firmware, misc-firmware, wlan-firmware)
FIRMWARE="brcmfmac_sdio-firmware meson-firmware"
# build and install ATV IR remote support (yes / no)
ATVCLIENT_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="no"
# driver addons to install:
DRIVER_ADDONS="crazycat dvb-latest"
# additional packages to install:
ADDITIONAL_PACKAGES="u-boot-script dtc ethmactool"
# use the kernel CEC framework for libcec (yes / no)
CEC_FRAMEWORK_SUPPORT="yes"
# debug tty path
DEBUG_TTY="/dev/ttyAML0"

View File

@ -0,0 +1,36 @@
# SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv)
PKG_NAME="amlogic-boot-fip"
PKG_LICENSE="nonfree"
PKG_SITE=""
PKG_LONGDESC="Amlogic Boot Firmare files used to wrap U-Boot to provide a functional boot blob"
PKG_TOOLCHAIN="manual"
PKG_STAMP="$UBOOT_SYSTEM"
case "$UBOOT_SYSTEM" in
khadas-vim*)
PKG_VERSION="20180207"
PKG_SHA256="8dfdf0a267bbedde2229f22d41f0573f67a182a2bb4852db3baae884315f5acc"
PKG_URL="https://github.com/BayLibre/u-boot/releases/download/v2017.11-libretech-cc/khadas-vim_fip_${PKG_VERSION}.tar.gz"
PKG_SOURCE_DIR="fip"
;;
nanopi-k2|p20*)
PKG_VERSION="20170412"
PKG_SHA256="4b5778098ca2a4f7ade06db7752ec9f77775d67e438d6fba0c669a4959ff7200"
PKG_URL="https://github.com/BayLibre/u-boot/releases/download/v2017.11-libretech-cc/nanopi-k2_fip_${PKG_VERSION}.tar.gz"
PKG_SOURCE_DIR="fip"
;;
odroid-c2)
PKG_VERSION="s905_6.0.1_v3.7"
PKG_SHA256="3ee700fd3a6439997060ac6d21217b0adba3a801876707fae70988f8ce6c3fef"
PKG_URL="https://github.com/hardkernel/u-boot/archive/${PKG_VERSION}.tar.gz"
PKG_SOURCE_DIR="u-boot-${PKG_VERSION}"
;;
*)
PKG_VERSION="20170606"
PKG_SHA256="957c96037bcd792a4139cc33eded2f006d55a82c0c56ae69ef43bdcb76a255e2"
PKG_URL="https://github.com/BayLibre/u-boot/releases/download/v2017.11-libretech-cc/p212_fip_${PKG_VERSION}.tar.gz"
PKG_SOURCE_DIR="fip"
;;
esac

View File

@ -0,0 +1,62 @@
From e5d21ff782977b0fe79a60796dc9d973d98e692c Mon Sep 17 00:00:00 2001
From: Maxime Jourdan <mjourdan@baylibre.com>
Date: Sun, 9 Sep 2018 17:22:35 +0200
Subject: [PATCH] avcodec: v4l2_context: set frame SAR using VIDIOC_CROPCAP
---
libavcodec/v4l2_context.c | 26 +++++++++++++++++++++++++-
1 file changed, 25 insertions(+), 1 deletion(-)
diff --git a/libavcodec/v4l2_context.c b/libavcodec/v4l2_context.c
index efcb0426e4..8bff58ca5d 100644
--- a/libavcodec/v4l2_context.c
+++ b/libavcodec/v4l2_context.c
@@ -501,6 +501,24 @@ static int v4l2_get_coded_format(V4L2Context* ctx, uint32_t *p)
return 0;
}
+static AVRational v4l2_get_sar(V4L2Context* ctx)
+{
+ struct AVRational sar = { 1, 1 };
+ struct v4l2_cropcap cropcap;
+ int ret;
+
+ memset(&cropcap, 0, sizeof(cropcap));
+ cropcap.type = ctx->type;
+
+ ret = ioctl(ctx_to_m2mctx(ctx)->fd, VIDIOC_CROPCAP, &cropcap);
+ if (ret)
+ return sar;
+
+ sar.num = cropcap.pixelaspect.numerator;
+ sar.den = cropcap.pixelaspect.denominator;
+ return sar;
+}
+
/*****************************************************************************
*
* V4L2 Context Interface
@@ -574,6 +592,7 @@ int ff_v4l2_context_enqueue_packet(V4L2Context* ctx, const AVPacket* pkt)
int ff_v4l2_context_dequeue_frame(V4L2Context* ctx, AVFrame* frame)
{
V4L2Buffer* avbuf = NULL;
+ int ret;
/*
* blocks until:
@@ -588,7 +607,12 @@ int ff_v4l2_context_dequeue_frame(V4L2Context* ctx, AVFrame* frame)
return AVERROR(EAGAIN);
}
- return ff_v4l2_buffer_buf_to_avframe(frame, avbuf);
+ ret = ff_v4l2_buffer_buf_to_avframe(frame, avbuf);
+ if (ret)
+ return ret;
+
+ frame->sample_aspect_ratio = v4l2_get_sar(ctx);
+ return 0;
}
int ff_v4l2_context_dequeue_packet(V4L2Context* ctx, AVPacket* pkt)
--
2.18.0

View File

@ -0,0 +1,768 @@
From 5c80d25f8f3821118fd4050321ac89e23bbedc8e Mon Sep 17 00:00:00 2001
From: Lukas Rusak <lorusak@gmail.com>
Date: Tue, 24 Apr 2018 22:48:23 -0700
Subject: [PATCH 1/6] libavcodec: v4l2m2m: fix indentation and add M2MDEC_CLASS
---
libavcodec/v4l2_m2m_dec.c | 44 ++++++++++++++++++++-------------------
1 file changed, 23 insertions(+), 21 deletions(-)
diff --git a/libavcodec/v4l2_m2m_dec.c b/libavcodec/v4l2_m2m_dec.c
index bca45be1484..ed5193ecc17 100644
--- a/libavcodec/v4l2_m2m_dec.c
+++ b/libavcodec/v4l2_m2m_dec.c
@@ -202,28 +202,30 @@ static const AVOption options[] = {
{ NULL},
};
+#define M2MDEC_CLASS(NAME) \
+ static const AVClass v4l2_m2m_ ## NAME ## _dec_class = { \
+ .class_name = #NAME "_v4l2_m2m_decoder", \
+ .item_name = av_default_item_name, \
+ .option = options, \
+ .version = LIBAVUTIL_VERSION_INT, \
+ };
+
#define M2MDEC(NAME, LONGNAME, CODEC, bsf_name) \
-static const AVClass v4l2_m2m_ ## NAME ## _dec_class = {\
- .class_name = #NAME "_v4l2_m2m_decoder",\
- .item_name = av_default_item_name,\
- .option = options,\
- .version = LIBAVUTIL_VERSION_INT,\
-};\
-\
-AVCodec ff_ ## NAME ## _v4l2m2m_decoder = { \
- .name = #NAME "_v4l2m2m" ,\
- .long_name = NULL_IF_CONFIG_SMALL("V4L2 mem2mem " LONGNAME " decoder wrapper"),\
- .type = AVMEDIA_TYPE_VIDEO,\
- .id = CODEC ,\
- .priv_data_size = sizeof(V4L2m2mPriv),\
- .priv_class = &v4l2_m2m_ ## NAME ## _dec_class,\
- .init = v4l2_decode_init,\
- .receive_frame = v4l2_receive_frame,\
- .close = ff_v4l2_m2m_codec_end,\
- .bsfs = bsf_name, \
- .capabilities = AV_CODEC_CAP_HARDWARE | AV_CODEC_CAP_DELAY, \
- .wrapper_name = "v4l2m2m", \
-};
+ M2MDEC_CLASS(NAME) \
+ AVCodec ff_ ## NAME ## _v4l2m2m_decoder = { \
+ .name = #NAME "_v4l2m2m" , \
+ .long_name = NULL_IF_CONFIG_SMALL("V4L2 mem2mem " LONGNAME " decoder wrapper"), \
+ .type = AVMEDIA_TYPE_VIDEO, \
+ .id = CODEC , \
+ .priv_data_size = sizeof(V4L2m2mPriv), \
+ .priv_class = &v4l2_m2m_ ## NAME ## _dec_class, \
+ .init = v4l2_decode_init, \
+ .receive_frame = v4l2_receive_frame, \
+ .close = ff_v4l2_m2m_codec_end, \
+ .bsfs = bsf_name, \
+ .capabilities = AV_CODEC_CAP_HARDWARE | AV_CODEC_CAP_DELAY, \
+ .wrapper_name = "v4l2m2m", \
+ };
M2MDEC(h264, "H.264", AV_CODEC_ID_H264, "h264_mp4toannexb");
M2MDEC(hevc, "HEVC", AV_CODEC_ID_HEVC, "hevc_mp4toannexb");
From ba04ebfb7ec5df1dff44b7cd6c0daac9146dcf3a Mon Sep 17 00:00:00 2001
From: Lukas Rusak <lorusak@gmail.com>
Date: Tue, 24 Apr 2018 23:00:23 -0700
Subject: [PATCH 2/6] libavcodec: v4l2m2m: output AVDRMFrameDescriptor
---
libavcodec/v4l2_buffers.c | 216 ++++++++++++++++++++++++++++++++------
libavcodec/v4l2_buffers.h | 4 +
libavcodec/v4l2_context.c | 40 ++++++-
libavcodec/v4l2_m2m.c | 4 +-
libavcodec/v4l2_m2m.h | 3 +
libavcodec/v4l2_m2m_dec.c | 23 ++++
6 files changed, 253 insertions(+), 37 deletions(-)
diff --git a/libavcodec/v4l2_buffers.c b/libavcodec/v4l2_buffers.c
index aef911f3bbc..e5c46ac81e6 100644
--- a/libavcodec/v4l2_buffers.c
+++ b/libavcodec/v4l2_buffers.c
@@ -21,6 +21,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <drm/drm_fourcc.h>
#include <linux/videodev2.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
@@ -29,6 +30,7 @@
#include <poll.h>
#include "libavcodec/avcodec.h"
#include "libavcodec/internal.h"
+#include "libavutil/hwcontext.h"
#include "v4l2_context.h"
#include "v4l2_buffers.h"
#include "v4l2_m2m.h"
@@ -203,7 +205,79 @@ static enum AVColorTransferCharacteristic v4l2_get_color_trc(V4L2Buffer *buf)
return AVCOL_TRC_UNSPECIFIED;
}
-static void v4l2_free_buffer(void *opaque, uint8_t *unused)
+static uint8_t * v4l2_get_drm_frame(V4L2Buffer *avbuf)
+{
+ AVDRMFrameDescriptor *drm_desc = &avbuf->drm_frame;
+ AVDRMLayerDescriptor *layer;
+
+ /* fill the DRM frame descriptor */
+ drm_desc->nb_objects = avbuf->num_planes;
+ drm_desc->nb_layers = 1;
+
+ layer = &drm_desc->layers[0];
+ layer->nb_planes = avbuf->num_planes;
+
+ for (int i = 0; i < avbuf->num_planes; i++) {
+ layer->planes[i].object_index = i;
+ layer->planes[i].offset = 0;
+ layer->planes[i].pitch = avbuf->plane_info[i].bytesperline;
+ }
+
+ switch (avbuf->context->av_pix_fmt) {
+ case AV_PIX_FMT_YUYV422:
+
+ layer->format = DRM_FORMAT_YUYV;
+ layer->nb_planes = 1;
+
+ break;
+
+ case AV_PIX_FMT_NV12:
+ case AV_PIX_FMT_NV21:
+
+ layer->format = avbuf->context->av_pix_fmt == AV_PIX_FMT_NV12 ?
+ DRM_FORMAT_NV12 : DRM_FORMAT_NV21;
+
+ if (avbuf->num_planes > 1)
+ break;
+
+ layer->nb_planes = 2;
+
+ layer->planes[1].object_index = 0;
+ layer->planes[1].offset = avbuf->plane_info[0].bytesperline *
+ avbuf->context->format.fmt.pix.height;
+ layer->planes[1].pitch = avbuf->plane_info[0].bytesperline;
+ break;
+
+ case AV_PIX_FMT_YUV420P:
+
+ layer->format = DRM_FORMAT_YUV420;
+
+ if (avbuf->num_planes > 1)
+ break;
+
+ layer->nb_planes = 3;
+
+ layer->planes[1].object_index = 0;
+ layer->planes[1].offset = avbuf->plane_info[0].bytesperline *
+ avbuf->context->format.fmt.pix.height;
+ layer->planes[1].pitch = avbuf->plane_info[0].bytesperline >> 1;
+
+ layer->planes[2].object_index = 0;
+ layer->planes[2].offset = layer->planes[1].offset +
+ ((avbuf->plane_info[0].bytesperline *
+ avbuf->context->format.fmt.pix.height) >> 2);
+ layer->planes[2].pitch = avbuf->plane_info[0].bytesperline >> 1;
+ break;
+
+ default:
+ drm_desc->nb_layers = 0;
+ break;
+ }
+
+ return (uint8_t *) drm_desc;
+}
+
+static void v4l2_free_buffer(void *opaque, uint8_t *data)
{
V4L2Buffer* avbuf = opaque;
V4L2m2mContext *s = buf_to_m2mctx(avbuf);
@@ -227,27 +301,47 @@ static void v4l2_free_buffer(void *opaque, uint8_t *unused)
}
}
-static int v4l2_buf_to_bufref(V4L2Buffer *in, int plane, AVBufferRef **buf)
+static int v4l2_buffer_export_drm(V4L2Buffer* avbuf)
{
- V4L2m2mContext *s = buf_to_m2mctx(in);
+ struct v4l2_exportbuffer expbuf;
+ int i, ret;
- if (plane >= in->num_planes)
- return AVERROR(EINVAL);
+ for (i = 0; i < avbuf->num_planes; i++) {
+ memset(&expbuf, 0, sizeof(expbuf));
- /* even though most encoders return 0 in data_offset encoding vp8 does require this value */
- *buf = av_buffer_create((char *)in->plane_info[plane].mm_addr + in->planes[plane].data_offset,
- in->plane_info[plane].length, v4l2_free_buffer, in, 0);
- if (!*buf)
- return AVERROR(ENOMEM);
+ expbuf.index = avbuf->buf.index;
+ expbuf.type = avbuf->buf.type;
+ expbuf.plane = i;
+
+ ret = ioctl(buf_to_m2mctx(avbuf)->fd, VIDIOC_EXPBUF, &expbuf);
+ if (ret < 0)
+ return AVERROR(errno);
+
+ if (V4L2_TYPE_IS_MULTIPLANAR(avbuf->buf.type)) {
+ /* drm frame */
+ avbuf->drm_frame.objects[i].size = avbuf->buf.m.planes[i].length;
+ avbuf->drm_frame.objects[i].fd = expbuf.fd;
+ } else {
+ /* drm frame */
+ avbuf->drm_frame.objects[0].size = avbuf->buf.length;
+ avbuf->drm_frame.objects[0].fd = expbuf.fd;
+ }
+ }
+
+ return 0;
+}
+
+static int v4l2_buf_increase_ref(V4L2Buffer *in)
+{
+ V4L2m2mContext *s = buf_to_m2mctx(in);
if (in->context_ref)
atomic_fetch_add(&in->context_refcount, 1);
else {
in->context_ref = av_buffer_ref(s->self_ref);
- if (!in->context_ref) {
- av_buffer_unref(buf);
+ if (!in->context_ref)
return AVERROR(ENOMEM);
- }
+
in->context_refcount = 1;
}
@@ -257,6 +351,46 @@ static int v4l2_buf_to_bufref(V4L2Buffer *in, int plane, AVBufferRef **buf)
return 0;
}
+static int v4l2_buf_to_bufref_drm(V4L2Buffer *in, AVBufferRef **buf)
+{
+ int ret;
+
+ *buf = av_buffer_create((uint8_t *) &in->drm_frame,
+ sizeof(in->drm_frame),
+ v4l2_free_buffer,
+ in, AV_BUFFER_FLAG_READONLY);
+ if (!*buf)
+ return AVERROR(ENOMEM);
+
+ ret = v4l2_buf_increase_ref(in);
+ if (ret)
+ av_buffer_unref(buf);
+
+ return ret;
+}
+
+static int v4l2_buf_to_bufref(V4L2Buffer *in, int plane, AVBufferRef **buf)
+{
+ int ret;
+
+ if (plane >= in->num_planes)
+ return AVERROR(EINVAL);
+
+ /* most encoders return 0 in data_offset but vp8 does require this value */
+ *buf = av_buffer_create((char *)in->plane_info[plane].mm_addr + in->planes[plane].data_offset,
+ in->plane_info[plane].length,
+ v4l2_free_buffer,
+ in, 0);
+ if (!*buf)
+ return AVERROR(ENOMEM);
+
+ ret = v4l2_buf_increase_ref(in);
+ if (ret)
+ av_buffer_unref(buf);
+
+ return ret;
+}
+
static int v4l2_bufref_to_buf(V4L2Buffer *out, int plane, const uint8_t* data, int size, AVBufferRef* bref)
{
unsigned int bytesused, length;
@@ -308,31 +442,43 @@ int ff_v4l2_buffer_buf_to_avframe(AVFrame *frame, V4L2Buffer *avbuf)
av_frame_unref(frame);
- /* 1. get references to the actual data */
- for (i = 0; i < avbuf->num_planes; i++) {
- ret = v4l2_buf_to_bufref(avbuf, i, &frame->buf[i]);
+ if (buf_to_m2mctx(avbuf)->output_drm) {
+ /* 1. get references to the actual data */
+ ret = v4l2_buf_to_bufref_drm(avbuf, &frame->buf[0]);
if (ret)
return ret;
- frame->linesize[i] = avbuf->plane_info[i].bytesperline;
- frame->data[i] = frame->buf[i]->data;
- }
+ frame->data[0] = (uint8_t *) v4l2_get_drm_frame(avbuf);
+ frame->format = AV_PIX_FMT_DRM_PRIME;
+ } else {
+ /* 1. get references to the actual data */
+ for (i = 0; i < avbuf->num_planes; i++) {
+ ret = v4l2_buf_to_bufref(avbuf, i, &frame->buf[i]);
+ if (ret)
+ return ret;
+
+ frame->linesize[i] = avbuf->plane_info[i].bytesperline;
+ frame->data[i] = frame->buf[i]->data;
+ }
- /* 1.1 fixup special cases */
- switch (avbuf->context->av_pix_fmt) {
- case AV_PIX_FMT_NV12:
- if (avbuf->num_planes > 1)
+ /* 1.1 fixup special cases */
+ switch (avbuf->context->av_pix_fmt) {
+ case AV_PIX_FMT_NV12:
+ if (avbuf->num_planes > 1)
+ break;
+ frame->linesize[1] = avbuf->plane_info[0].bytesperline;
+ frame->data[1] = frame->buf[0]->data +
+ avbuf->plane_info[0].bytesperline *
+ avbuf->context->format.fmt.pix.height;
break;
- frame->linesize[1] = avbuf->plane_info[0].bytesperline;
- frame->data[1] = frame->buf[0]->data + avbuf->plane_info[0].bytesperline * avbuf->context->format.fmt.pix_mp.height;
- break;
- default:
- break;
+ default:
+ break;
+ }
+ frame->format = avbuf->context->av_pix_fmt;
}
/* 2. get frame information */
frame->key_frame = !!(avbuf->buf.flags & V4L2_BUF_FLAG_KEYFRAME);
- frame->format = avbuf->context->av_pix_fmt;
frame->color_primaries = v4l2_get_color_primaries(avbuf);
frame->colorspace = v4l2_get_color_space(avbuf);
frame->color_range = v4l2_get_color_range(avbuf);
@@ -447,9 +593,6 @@ int ff_v4l2_buffer_initialize(V4L2Buffer* avbuf, int index)
avbuf->status = V4L2BUF_AVAILABLE;
- if (V4L2_TYPE_IS_OUTPUT(ctx->type))
- return 0;
-
if (V4L2_TYPE_IS_MULTIPLANAR(ctx->type)) {
avbuf->buf.m.planes = avbuf->planes;
avbuf->buf.length = avbuf->num_planes;
@@ -459,6 +602,15 @@ int ff_v4l2_buffer_initialize(V4L2Buffer* avbuf, int index)
avbuf->buf.length = avbuf->planes[0].length;
}
+ if (V4L2_TYPE_IS_OUTPUT(ctx->type))
+ return 0;
+
+ if (buf_to_m2mctx(avbuf)->output_drm) {
+ ret = v4l2_buffer_export_drm(avbuf);
+ if (ret)
+ return ret;
+ }
+
return ff_v4l2_buffer_enqueue(avbuf);
}
diff --git a/libavcodec/v4l2_buffers.h b/libavcodec/v4l2_buffers.h
index dc5cc9e2671..a8a50ecc65f 100644
--- a/libavcodec/v4l2_buffers.h
+++ b/libavcodec/v4l2_buffers.h
@@ -27,6 +27,7 @@
#include <stdatomic.h>
#include <linux/videodev2.h>
+#include "libavutil/hwcontext_drm.h"
#include "avcodec.h"
enum V4L2Buffer_status {
@@ -42,6 +43,9 @@ typedef struct V4L2Buffer {
/* each buffer needs to have a reference to its context */
struct V4L2Context *context;
+ /* DRM descriptor */
+ AVDRMFrameDescriptor drm_frame;
+
/* This object is refcounted per-plane, so we need to keep track
* of how many context-refs we are holding. */
AVBufferRef *context_ref;
diff --git a/libavcodec/v4l2_context.c b/libavcodec/v4l2_context.c
index efcb0426e49..9457fadb1e9 100644
--- a/libavcodec/v4l2_context.c
+++ b/libavcodec/v4l2_context.c
@@ -393,22 +393,54 @@ static int v4l2_release_buffers(V4L2Context* ctx)
struct v4l2_requestbuffers req = {
.memory = V4L2_MEMORY_MMAP,
.type = ctx->type,
- .count = 0, /* 0 -> unmaps buffers from the driver */
+ .count = 0, /* 0 -> unmap all buffers from the driver */
};
- int i, j;
+ int ret, i, j;
for (i = 0; i < ctx->num_buffers; i++) {
V4L2Buffer *buffer = &ctx->buffers[i];
for (j = 0; j < buffer->num_planes; j++) {
struct V4L2Plane_info *p = &buffer->plane_info[j];
+
+ if (V4L2_TYPE_IS_OUTPUT(ctx->type)) {
+ /* output buffers are not EXPORTED */
+ goto unmap;
+ }
+
+ if (ctx_to_m2mctx(ctx)->output_drm) {
+ /* use the DRM frame to close */
+ if (buffer->drm_frame.objects[j].fd >= 0) {
+ if (close(buffer->drm_frame.objects[j].fd) < 0) {
+ av_log(logger(ctx), AV_LOG_ERROR, "%s close drm fd "
+ "[buffer=%2d, plane=%d, fd=%2d] - %s \n",
+ ctx->name, i, j, buffer->drm_frame.objects[j].fd,
+ av_err2str(AVERROR(errno)));
+ }
+ }
+ }
+unmap:
if (p->mm_addr && p->length)
if (munmap(p->mm_addr, p->length) < 0)
- av_log(logger(ctx), AV_LOG_ERROR, "%s unmap plane (%s))\n", ctx->name, av_err2str(AVERROR(errno)));
+ av_log(logger(ctx), AV_LOG_ERROR, "%s unmap plane (%s))\n",
+ ctx->name, av_err2str(AVERROR(errno)));
}
}
- return ioctl(ctx_to_m2mctx(ctx)->fd, VIDIOC_REQBUFS, &req);
+ ret = ioctl(ctx_to_m2mctx(ctx)->fd, VIDIOC_REQBUFS, &req);
+ if (ret < 0) {
+ av_log(logger(ctx), AV_LOG_ERROR, "release all %s buffers (%s)\n",
+ ctx->name, av_err2str(AVERROR(errno)));
+
+ if (ctx_to_m2mctx(ctx)->output_drm)
+ av_log(logger(ctx), AV_LOG_ERROR,
+ "Make sure the DRM client releases all FB/GEM objects before closing the codec (ie):\n"
+ "for all buffers: \n"
+ " 1. drmModeRmFB(..)\n"
+ " 2. drmIoctl(.., DRM_IOCTL_GEM_CLOSE,... )\n");
+ }
+
+ return ret;
}
static inline int v4l2_try_raw_format(V4L2Context* ctx, enum AVPixelFormat pixfmt)
diff --git a/libavcodec/v4l2_m2m.c b/libavcodec/v4l2_m2m.c
index 427e165f586..7896326e808 100644
--- a/libavcodec/v4l2_m2m.c
+++ b/libavcodec/v4l2_m2m.c
@@ -159,7 +159,9 @@ static int v4l2_configure_contexts(V4L2m2mContext* s)
goto error;
}
- /* decoder's buffers need to be updated at a later stage */
+ /* decoder's capture buffers are updated during v4l2_try_start once we find
+ * the valid format.
+ */
if (!av_codec_is_decoder(s->avctx->codec)) {
ret = ff_v4l2_context_init(&s->capture);
if (ret) {
diff --git a/libavcodec/v4l2_m2m.h b/libavcodec/v4l2_m2m.h
index 452bf0d9bc2..9ac5a2448da 100644
--- a/libavcodec/v4l2_m2m.h
+++ b/libavcodec/v4l2_m2m.h
@@ -59,6 +59,9 @@ typedef struct V4L2m2mContext {
/* Reference to self; only valid while codec is active. */
AVBufferRef *self_ref;
+
+ /* generate DRM frames */
+ int output_drm;
} V4L2m2mContext;
typedef struct V4L2m2mPriv
diff --git a/libavcodec/v4l2_m2m_dec.c b/libavcodec/v4l2_m2m_dec.c
index ed5193ecc17..7f41e3b2121 100644
--- a/libavcodec/v4l2_m2m_dec.c
+++ b/libavcodec/v4l2_m2m_dec.c
@@ -23,12 +23,18 @@
#include <linux/videodev2.h>
#include <sys/ioctl.h>
+
+#include "libavutil/hwcontext.h"
+#include "libavutil/hwcontext_drm.h"
#include "libavutil/pixfmt.h"
#include "libavutil/pixdesc.h"
#include "libavutil/opt.h"
#include "libavcodec/avcodec.h"
#include "libavcodec/decode.h"
+#include "libavcodec/hwaccel.h"
+#include "libavcodec/internal.h"
+
#include "v4l2_context.h"
#include "v4l2_m2m.h"
#include "v4l2_fmt.h"
@@ -183,6 +189,15 @@ static av_cold int v4l2_decode_init(AVCodecContext *avctx)
capture->av_codec_id = AV_CODEC_ID_RAWVIDEO;
capture->av_pix_fmt = avctx->pix_fmt;
+ /* the client requests the codec to generate DRM frames:
+ * - data[0] will therefore point to the returned AVDRMFrameDescriptor
+ * check the ff_v4l2_buffer_to_avframe conversion function.
+ * - the DRM frame format is passed in the DRM frame descriptor layer.
+ * check the v4l2_get_drm_frame function.
+ */
+ if (ff_get_format(avctx, avctx->codec->pix_fmts) == AV_PIX_FMT_DRM_PRIME)
+ s->output_drm = 1;
+
ret = ff_v4l2_m2m_codec_init(avctx);
if (ret) {
av_log(avctx, AV_LOG_ERROR, "can't configure decoder\n");
@@ -202,6 +217,11 @@ static const AVOption options[] = {
{ NULL},
};
+static const AVCodecHWConfigInternal *v4l2_m2m_hw_configs[] = {
+ HW_CONFIG_INTERNAL(DRM_PRIME),
+ NULL
+};
+
#define M2MDEC_CLASS(NAME) \
static const AVClass v4l2_m2m_ ## NAME ## _dec_class = { \
.class_name = #NAME "_v4l2_m2m_decoder", \
@@ -222,7 +242,10 @@ static const AVOption options[] = {
.init = v4l2_decode_init, \
.receive_frame = v4l2_receive_frame, \
.close = ff_v4l2_m2m_codec_end, \
+ .pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_DRM_PRIME, \
+ AV_PIX_FMT_NONE}, \
.bsfs = bsf_name, \
+ .hw_configs = v4l2_m2m_hw_configs, \
.capabilities = AV_CODEC_CAP_HARDWARE | AV_CODEC_CAP_DELAY, \
.wrapper_name = "v4l2m2m", \
};
From 56b801661f935994d971c6b4aaf0d0ed3c4ca83f Mon Sep 17 00:00:00 2001
From: Lukas Rusak <lorusak@gmail.com>
Date: Tue, 8 May 2018 22:40:23 -0700
Subject: [PATCH 3/6] libavcodec: v4l2m2m: adjust formatting
---
libavcodec/v4l2_buffers.c | 23 +++++++++++++++--------
libavcodec/v4l2_buffers.h | 1 -
2 files changed, 15 insertions(+), 9 deletions(-)
diff --git a/libavcodec/v4l2_buffers.c b/libavcodec/v4l2_buffers.c
index e5c46ac81e6..897c3c46369 100644
--- a/libavcodec/v4l2_buffers.c
+++ b/libavcodec/v4l2_buffers.c
@@ -401,7 +401,8 @@ static int v4l2_bufref_to_buf(V4L2Buffer *out, int plane, const uint8_t* data, i
bytesused = FFMIN(size, out->plane_info[plane].length);
length = out->plane_info[plane].length;
- memcpy(out->plane_info[plane].mm_addr, data, FFMIN(size, out->plane_info[plane].length));
+ memcpy(out->plane_info[plane].mm_addr, data,
+ FFMIN(size, out->plane_info[plane].length));
if (V4L2_TYPE_IS_MULTIPLANAR(out->buf.type)) {
out->planes[plane].bytesused = bytesused;
@@ -425,7 +426,10 @@ int ff_v4l2_buffer_avframe_to_buf(const AVFrame *frame, V4L2Buffer* out)
int i, ret;
for(i = 0; i < out->num_planes; i++) {
- ret = v4l2_bufref_to_buf(out, i, frame->buf[i]->data, frame->buf[i]->size, frame->buf[i]);
+ ret = v4l2_bufref_to_buf(out, i,
+ frame->buf[i]->data,
+ frame->buf[i]->size,
+ frame->buf[i]);
if (ret)
return ret;
}
@@ -480,8 +484,8 @@ int ff_v4l2_buffer_buf_to_avframe(AVFrame *frame, V4L2Buffer *avbuf)
/* 2. get frame information */
frame->key_frame = !!(avbuf->buf.flags & V4L2_BUF_FLAG_KEYFRAME);
frame->color_primaries = v4l2_get_color_primaries(avbuf);
- frame->colorspace = v4l2_get_color_space(avbuf);
frame->color_range = v4l2_get_color_range(avbuf);
+ frame->colorspace = v4l2_get_color_space(avbuf);
frame->color_trc = v4l2_get_color_trc(avbuf);
frame->pts = v4l2_get_pts(avbuf);
@@ -507,7 +511,8 @@ int ff_v4l2_buffer_buf_to_avpkt(AVPacket *pkt, V4L2Buffer *avbuf)
if (ret)
return ret;
- pkt->size = V4L2_TYPE_IS_MULTIPLANAR(avbuf->buf.type) ? avbuf->buf.m.planes[0].bytesused : avbuf->buf.bytesused;
+ pkt->size = V4L2_TYPE_IS_MULTIPLANAR(avbuf->buf.type) ?
+ avbuf->buf.m.planes[0].bytesused : avbuf->buf.bytesused;
pkt->data = pkt->buf->data;
if (avbuf->buf.flags & V4L2_BUF_FLAG_KEYFRAME)
@@ -563,6 +568,7 @@ int ff_v4l2_buffer_initialize(V4L2Buffer* avbuf, int index)
/* in MP, the V4L2 API states that buf.length means num_planes */
if (avbuf->num_planes >= avbuf->buf.length)
break;
+
if (avbuf->buf.m.planes[avbuf->num_planes].length)
avbuf->num_planes++;
}
@@ -579,12 +585,14 @@ int ff_v4l2_buffer_initialize(V4L2Buffer* avbuf, int index)
avbuf->plane_info[i].length = avbuf->buf.m.planes[i].length;
avbuf->plane_info[i].mm_addr = mmap(NULL, avbuf->buf.m.planes[i].length,
PROT_READ | PROT_WRITE, MAP_SHARED,
- buf_to_m2mctx(avbuf)->fd, avbuf->buf.m.planes[i].m.mem_offset);
+ buf_to_m2mctx(avbuf)->fd,
+ avbuf->buf.m.planes[i].m.mem_offset);
} else {
avbuf->plane_info[i].length = avbuf->buf.length;
avbuf->plane_info[i].mm_addr = mmap(NULL, avbuf->buf.length,
PROT_READ | PROT_WRITE, MAP_SHARED,
- buf_to_m2mctx(avbuf)->fd, avbuf->buf.m.offset);
+ buf_to_m2mctx(avbuf)->fd,
+ avbuf->buf.m.offset);
}
if (avbuf->plane_info[i].mm_addr == MAP_FAILED)
@@ -594,9 +602,8 @@ int ff_v4l2_buffer_initialize(V4L2Buffer* avbuf, int index)
avbuf->status = V4L2BUF_AVAILABLE;
if (V4L2_TYPE_IS_MULTIPLANAR(ctx->type)) {
- avbuf->buf.m.planes = avbuf->planes;
avbuf->buf.length = avbuf->num_planes;
-
+ avbuf->buf.m.planes = avbuf->planes;
} else {
avbuf->buf.bytesused = avbuf->planes[0].bytesused;
avbuf->buf.length = avbuf->planes[0].length;
diff --git a/libavcodec/v4l2_buffers.h b/libavcodec/v4l2_buffers.h
index a8a50ecc65f..c609a6c6767 100644
--- a/libavcodec/v4l2_buffers.h
+++ b/libavcodec/v4l2_buffers.h
@@ -131,5 +131,4 @@ int ff_v4l2_buffer_initialize(V4L2Buffer* avbuf, int index);
*/
int ff_v4l2_buffer_enqueue(V4L2Buffer* avbuf);
-
#endif // AVCODEC_V4L2_BUFFERS_H
From 992ecd533321b876438fe3c4b7630003f260974e Mon Sep 17 00:00:00 2001
From: Jorge Ramirez-Ortiz <jramirez@baylibre.com>
Date: Sun, 6 May 2018 19:56:30 +0200
Subject: [PATCH 4/6] libavcodec: v4l2m2m: fix error handling during buffer
init
Signed-off-by: Jorge Ramirez-Ortiz <jramirez@baylibre.com>
---
libavcodec/v4l2_context.c | 19 ++++++++++++++++---
libavcodec/v4l2_m2m_dec.c | 11 ++++++++---
2 files changed, 24 insertions(+), 6 deletions(-)
diff --git a/libavcodec/v4l2_context.c b/libavcodec/v4l2_context.c
index 9457fadb1e9..fd3161ce2f5 100644
--- a/libavcodec/v4l2_context.c
+++ b/libavcodec/v4l2_context.c
@@ -263,6 +263,12 @@ static V4L2Buffer* v4l2_dequeue_v4l2buf(V4L2Context *ctx, int timeout)
/* if we are draining and there are no more capture buffers queued in the driver we are done */
if (!V4L2_TYPE_IS_OUTPUT(ctx->type) && ctx_to_m2mctx(ctx)->draining) {
for (i = 0; i < ctx->num_buffers; i++) {
+ /* catpture buffer initialization happens during decode hence
+ * detection happens at runtime
+ */
+ if (!ctx->buffers)
+ break;
+
if (ctx->buffers[i].status == V4L2BUF_IN_DRIVER)
goto start;
}
@@ -724,9 +730,8 @@ int ff_v4l2_context_init(V4L2Context* ctx)
ctx->buffers[i].context = ctx;
ret = ff_v4l2_buffer_initialize(&ctx->buffers[i], i);
if (ret < 0) {
- av_log(logger(ctx), AV_LOG_ERROR, "%s buffer initialization (%s)\n", ctx->name, av_err2str(ret));
- av_free(ctx->buffers);
- return ret;
+ av_log(logger(ctx), AV_LOG_ERROR, "%s buffer[%d] initialization (%s)\n", ctx->name, i, av_err2str(ret));
+ goto error;
}
}
@@ -739,4 +744,12 @@ int ff_v4l2_context_init(V4L2Context* ctx)
V4L2_TYPE_IS_MULTIPLANAR(ctx->type) ? ctx->format.fmt.pix_mp.plane_fmt[0].bytesperline : ctx->format.fmt.pix.bytesperline);
return 0;
+
+error:
+ v4l2_release_buffers(ctx);
+
+ av_free(ctx->buffers);
+ ctx->buffers = NULL;
+
+ return ret;
}
diff --git a/libavcodec/v4l2_m2m_dec.c b/libavcodec/v4l2_m2m_dec.c
index 7f41e3b2121..d524fd29a6a 100644
--- a/libavcodec/v4l2_m2m_dec.c
+++ b/libavcodec/v4l2_m2m_dec.c
@@ -92,8 +92,8 @@ static int v4l2_try_start(AVCodecContext *avctx)
if (!capture->buffers) {
ret = ff_v4l2_context_init(capture);
if (ret) {
- av_log(avctx, AV_LOG_DEBUG, "can't request output buffers\n");
- return ret;
+ av_log(avctx, AV_LOG_ERROR, "can't request capture buffers\n");
+ return AVERROR(ENOMEM);
}
}
@@ -155,8 +155,13 @@ static int v4l2_receive_frame(AVCodecContext *avctx, AVFrame *frame)
if (avpkt.size) {
ret = v4l2_try_start(avctx);
- if (ret)
+ if (ret) {
+ /* cant recover */
+ if (ret == AVERROR(ENOMEM))
+ return ret;
+
return 0;
+ }
}
dequeue:
From 98f828fcb15f2bcec11a6b8f56ae808c4c1220c2 Mon Sep 17 00:00:00 2001
From: Lukas Rusak <lorusak@gmail.com>
Date: Sun, 17 Jun 2018 22:56:37 -0700
Subject: [PATCH 6/6] libavcodec: v4l2m2m: make sure to unref avpkt
---
libavcodec/v4l2_m2m_dec.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/libavcodec/v4l2_m2m_dec.c b/libavcodec/v4l2_m2m_dec.c
index 6dd0de7ffcf..6fdbf8f16e4 100644
--- a/libavcodec/v4l2_m2m_dec.c
+++ b/libavcodec/v4l2_m2m_dec.c
@@ -156,6 +156,7 @@ static int v4l2_receive_frame(AVCodecContext *avctx, AVFrame *frame)
if (avpkt.size) {
ret = v4l2_try_start(avctx);
if (ret) {
+ av_packet_unref(&avpkt);
/* cant recover */
if (ret == AVERROR(ENOMEM))
return ret;
@@ -165,6 +166,7 @@ static int v4l2_receive_frame(AVCodecContext *avctx, AVFrame *frame)
}
dequeue:
+ av_packet_unref(&avpkt);
return ff_v4l2_context_dequeue_frame(capture, frame);
}

View File

@ -0,0 +1,11 @@
--- a/libavcodec/v4l2_m2m.h 2018-07-22 11:04:44.223961230 +0100
+++ b/libavcodec/v4l2_m2m.h 2018-07-30 18:19:54.780753049 +0100
@@ -38,7 +38,7 @@
#define V4L_M2M_DEFAULT_OPTS \
{ "num_output_buffers", "Number of buffers in the output context",\
- OFFSET(num_output_buffers), AV_OPT_TYPE_INT, { .i64 = 16 }, 6, INT_MAX, FLAGS }
+ OFFSET(num_output_buffers), AV_OPT_TYPE_INT, { .i64 = 2 }, 1, INT_MAX, FLAGS }
typedef struct V4L2m2mContext {
char devname[PATH_MAX];

View File

@ -0,0 +1,51 @@
diff --git a/libavcodec/v4l2_m2m_dec.c b/libavcodec/v4l2_m2m_dec.c
index 80a09f7a43..af65927ac3 100644
--- a/libavcodec/v4l2_m2m_dec.c
+++ b/libavcodec/v4l2_m2m_dec.c
@@ -125,6 +125,8 @@ static int v4l2_prepare_decoder(V4L2m2mContext *s)
return 0;
}
+static AVPacket saved_avpkt = { 0 };
+
static int v4l2_receive_frame(AVCodecContext *avctx, AVFrame *frame)
{
V4L2m2mContext *s = ((V4L2m2mPriv*)avctx->priv_data)->context;
@@ -133,9 +135,14 @@ static int v4l2_receive_frame(AVCodecContext *avctx, AVFrame *frame)
AVPacket avpkt = {0};
int ret;
- ret = ff_decode_get_packet(avctx, &avpkt);
- if (ret < 0 && ret != AVERROR_EOF)
- return ret;
+ if (saved_avpkt.size) {
+ avpkt = saved_avpkt;
+ memset(&saved_avpkt, 0, sizeof(saved_avpkt));
+ } else {
+ ret = ff_decode_get_packet(avctx, &avpkt);
+ if (ret < 0 && ret != AVERROR_EOF)
+ return ret;
+ }
if (s->draining)
goto dequeue;
@@ -144,6 +151,8 @@ static int v4l2_receive_frame(AVCodecContext *avctx, AVFrame *frame)
if (ret < 0) {
if (ret != AVERROR(ENOMEM))
return ret;
+
+ saved_avpkt = avpkt;
/* no input buffers available, continue dequeing */
}
@@ -156,7 +165,8 @@ static int v4l2_receive_frame(AVCodecContext *avctx, AVFrame *frame)
}
dequeue:
- av_packet_unref(&avpkt);
+ if (!saved_avpkt.size)
+ av_packet_unref(&avpkt);
return ff_v4l2_context_dequeue_frame(capture, frame);
}

View File

@ -0,0 +1,39 @@
From 4d6af620f4d6a6645229dcf3403a397dfb1a8a93 Mon Sep 17 00:00:00 2001
From: Lukas Rusak <lorusak@gmail.com>
Date: Mon, 15 Apr 2019 16:51:09 -0700
Subject: [PATCH] CDRMUtils: rework modifiers flag selection
---
xbmc/windowing/gbm/DRMUtils.cpp | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/xbmc/windowing/gbm/DRMUtils.cpp b/xbmc/windowing/gbm/DRMUtils.cpp
index df46ad4bdc25..8e1ec9d0dcb5 100644
--- a/xbmc/windowing/gbm/DRMUtils.cpp
+++ b/xbmc/windowing/gbm/DRMUtils.cpp
@@ -109,10 +109,13 @@ drm_fb * CDRMUtils::DrmFbGetFromBo(struct gbm_bo *bo)
memset(offsets, 0, 16);
#endif
- if (modifiers[0] == DRM_FORMAT_MOD_INVALID)
- modifiers[0] = DRM_FORMAT_MOD_LINEAR;
+ uint32_t flags = 0;
- CLog::Log(LOGDEBUG, "CDRMUtils::%s - using modifier: %lli", __FUNCTION__, modifiers[0]);
+ if (modifiers[0] && modifiers[0] != DRM_FORMAT_MOD_INVALID)
+ {
+ flags |= DRM_MODE_FB_MODIFIERS;
+ CLog::Log(LOGDEBUG, "CDRMUtils::{} - using modifier: {:#x}", __FUNCTION__, modifiers[0]);
+ }
auto ret = drmModeAddFB2WithModifiers(m_fd,
width,
@@ -123,7 +126,7 @@ drm_fb * CDRMUtils::DrmFbGetFromBo(struct gbm_bo *bo)
offsets,
modifiers,
&fb->fb_id,
- (modifiers[0] > 0) ? DRM_MODE_FB_MODIFIERS : 0);
+ flags);
if(ret)
{

View File

@ -0,0 +1,383 @@
From af01b284b158891d258b3a2617697b9779af11c5 Mon Sep 17 00:00:00 2001
From: Lukas Rusak <lorusak@gmail.com>
Date: Thu, 7 Mar 2019 15:08:24 -0800
Subject: [PATCH 1/4] CEGLFence: add class to help with EGL sync objects
---
xbmc/utils/CMakeLists.txt | 6 ++--
xbmc/utils/EGLFence.cpp | 68 +++++++++++++++++++++++++++++++++++++++
xbmc/utils/EGLFence.h | 32 ++++++++++++++++++
3 files changed, 104 insertions(+), 2 deletions(-)
create mode 100644 xbmc/utils/EGLFence.cpp
create mode 100644 xbmc/utils/EGLFence.h
diff --git a/xbmc/utils/CMakeLists.txt b/xbmc/utils/CMakeLists.txt
index f0ce99014b84..6dbee35a1a60 100644
--- a/xbmc/utils/CMakeLists.txt
+++ b/xbmc/utils/CMakeLists.txt
@@ -169,8 +169,10 @@ if(XSLT_FOUND)
list(APPEND HEADERS XSLTUtils.h)
endif()
if(EGL_FOUND)
- list(APPEND SOURCES EGLUtils.cpp)
- list(APPEND HEADERS EGLUtils.h)
+ list(APPEND SOURCES EGLUtils.cpp
+ EGLFence.cpp)
+ list(APPEND HEADERS EGLUtils.h
+ EGLFence.h)
endif()
# The large map trips the clang optimizer
diff --git a/xbmc/utils/EGLFence.cpp b/xbmc/utils/EGLFence.cpp
new file mode 100644
index 000000000000..55cc45c4282a
--- /dev/null
+++ b/xbmc/utils/EGLFence.cpp
@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2017-2018 Team Kodi
+ * This file is part of Kodi - https://kodi.tv
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ * See LICENSES/README.md for more information.
+ */
+
+#include "EGLFence.h"
+
+#include "EGLUtils.h"
+
+CEGLFence::CEGLFence(EGLDisplay display) :
+ m_display(display)
+{
+ m_eglCreateSyncKHR = CEGLUtils::GetRequiredProcAddress<PFNEGLCREATESYNCKHRPROC>("eglCreateSyncKHR");
+ m_eglDestroySyncKHR = CEGLUtils::GetRequiredProcAddress<PFNEGLDESTROYSYNCKHRPROC>("eglDestroySyncKHR");
+ m_eglGetSyncAttribKHR = CEGLUtils::GetRequiredProcAddress<PFNEGLGETSYNCATTRIBKHRPROC>("eglGetSyncAttribKHR");
+}
+
+bool CEGLFence::CreateFence()
+{
+ m_fence = m_eglCreateSyncKHR(m_display, EGL_SYNC_FENCE_KHR, nullptr);
+ if (m_fence == EGL_NO_SYNC_KHR)
+ {
+ CEGLUtils::LogError("failed to create egl sync fence");
+ return false;
+ }
+
+ return true;
+}
+
+void CEGLFence::DestroyFence()
+{
+ if (m_fence == EGL_NO_SYNC_KHR)
+ {
+ return;
+ }
+
+ if (m_eglDestroySyncKHR(m_display, m_fence) != EGL_TRUE)
+ {
+ CEGLUtils::LogError("failed to destroy egl sync fence");
+ }
+
+ m_fence = EGL_NO_SYNC_KHR;
+}
+
+bool CEGLFence::IsSignaled()
+{
+ if (m_fence == EGL_NO_SYNC_KHR)
+ {
+ return false;
+ }
+
+ EGLint status = EGL_UNSIGNALED_KHR;
+ if (m_eglGetSyncAttribKHR(m_display, m_fence, EGL_SYNC_STATUS_KHR, &status) != EGL_TRUE)
+ {
+ CEGLUtils::LogError("failed to query egl sync fence");
+ return false;
+ }
+
+ if (status == EGL_SIGNALED_KHR)
+ {
+ return true;
+ }
+
+ return false;
+}
diff --git a/xbmc/utils/EGLFence.h b/xbmc/utils/EGLFence.h
new file mode 100644
index 000000000000..eb285ac4260e
--- /dev/null
+++ b/xbmc/utils/EGLFence.h
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2017-2018 Team Kodi
+ * This file is part of Kodi - https://kodi.tv
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ * See LICENSES/README.md for more information.
+ */
+
+#pragma once
+
+#include <EGL/egl.h>
+#include <EGL/eglext.h>
+
+class CEGLFence
+{
+public:
+ explicit CEGLFence(EGLDisplay display);
+ CEGLFence(CEGLFence const& other) = delete;
+ CEGLFence& operator=(CEGLFence const& other) = delete;
+
+ bool CreateFence();
+ void DestroyFence();
+ bool IsSignaled();
+
+private:
+ EGLDisplay m_display{nullptr};
+ EGLSyncKHR m_fence{nullptr};
+
+ PFNEGLCREATESYNCKHRPROC m_eglCreateSyncKHR{nullptr};
+ PFNEGLDESTROYSYNCKHRPROC m_eglDestroySyncKHR{nullptr};
+ PFNEGLGETSYNCATTRIBKHRPROC m_eglGetSyncAttribKHR{nullptr};
+};
From eebac4f4e456aa3eb174286bf69073b1e740e4a9 Mon Sep 17 00:00:00 2001
From: Lukas Rusak <lorusak@gmail.com>
Date: Thu, 7 Mar 2019 18:43:15 -0800
Subject: [PATCH 2/4] CRendererDRMPRIMEGLES: use CEGLFence to sync rendering
---
.../HwDecRender/RendererDRMPRIMEGLES.cpp | 23 +++++++++++++++++++
.../HwDecRender/RendererDRMPRIMEGLES.h | 8 +++++++
2 files changed, 31 insertions(+)
diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererDRMPRIMEGLES.cpp b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererDRMPRIMEGLES.cpp
index 330823196fbc..5b8d82c2cd2f 100644
--- a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererDRMPRIMEGLES.cpp
+++ b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererDRMPRIMEGLES.cpp
@@ -10,6 +10,7 @@
#include "cores/VideoPlayer/VideoRenderers/RenderFactory.h"
#include "ServiceBroker.h"
+#include "utils/EGLFence.h"
#include "utils/log.h"
#include "windowing/gbm/WinSystemGbmGLESContext.h"
@@ -43,15 +44,32 @@ bool CRendererDRMPRIMEGLES::Configure(const VideoPicture &picture, float fps, un
for (auto &texture : m_DRMPRIMETextures)
texture.Init(winSystem->GetEGLDisplay());
+ for (auto& fence : m_fences)
+ {
+ fence.reset(new CEGLFence(winSystem->GetEGLDisplay()));
+ }
+
return CLinuxRendererGLES::Configure(picture, fps, orientation);
}
void CRendererDRMPRIMEGLES::ReleaseBuffer(int index)
{
+ m_fences[index]->DestroyFence();
+
m_DRMPRIMETextures[index].Unmap();
CLinuxRendererGLES::ReleaseBuffer(index);
}
+bool CRendererDRMPRIMEGLES::NeedBuffer(int index)
+{
+ if (m_fences[index]->IsSignaled())
+ {
+ return false;
+ }
+
+ return true;
+}
+
bool CRendererDRMPRIMEGLES::CreateTexture(int index)
{
CPictureBuffer &buf = m_buffers[index];
@@ -188,3 +206,8 @@ bool CRendererDRMPRIMEGLES::RenderHook(int index)
return true;
}
+
+void CRendererDRMPRIMEGLES::AfterRenderHook(int index)
+{
+ m_fences[index]->CreateFence();
+}
diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererDRMPRIMEGLES.h b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererDRMPRIMEGLES.h
index f879b6cf5a38..1666f70443ac 100644
--- a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererDRMPRIMEGLES.h
+++ b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererDRMPRIMEGLES.h
@@ -11,6 +11,11 @@
#include "cores/VideoPlayer/VideoRenderers/LinuxRendererGLES.h"
#include "DRMPRIMEEGL.h"
+#include <array>
+#include <memory>
+
+class CEGLFence;
+
class CRendererDRMPRIMEGLES : public CLinuxRendererGLES
{
public:
@@ -24,14 +29,17 @@ class CRendererDRMPRIMEGLES : public CLinuxRendererGLES
// CLinuxRendererGLES overrides
bool Configure(const VideoPicture &picture, float fps, unsigned int orientation) override;
void ReleaseBuffer(int index) override;
+ bool NeedBuffer(int index) override;
protected:
// CLinuxRendererGLES overrides
bool LoadShadersHook() override;
bool RenderHook(int index) override;
+ void AfterRenderHook(int index) override;
bool UploadTexture(int index) override;
void DeleteTexture(int index) override;
bool CreateTexture(int index) override;
+ std::array<std::unique_ptr<CEGLFence>, NUM_BUFFERS> m_fences;
CDRMPRIMETexture m_DRMPRIMETextures[NUM_BUFFERS];
};
From 86d11125437086b290ec380cbe200acd96e76475 Mon Sep 17 00:00:00 2001
From: Lukas Rusak <lorusak@gmail.com>
Date: Mon, 18 Feb 2019 19:18:39 -0800
Subject: [PATCH 3/4] CRendererDRMPRIMEGLES: update VBO's to be similar to
CLinuxRendererGL
---
.../HwDecRender/RendererDRMPRIMEGLES.cpp | 48 ++++++++++++-------
1 file changed, 32 insertions(+), 16 deletions(-)
diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererDRMPRIMEGLES.cpp b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererDRMPRIMEGLES.cpp
index 5b8d82c2cd2f..1f3176422885 100644
--- a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererDRMPRIMEGLES.cpp
+++ b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererDRMPRIMEGLES.cpp
@@ -157,28 +157,44 @@ bool CRendererDRMPRIMEGLES::RenderHook(int index)
{
float x, y, z;
float u1, v1;
- } vertex[4];
+ };
+
+ std::array<PackedVertex, 4> vertex;
GLint vertLoc = renderSystem->GUIShaderGetPos();
GLint loc = renderSystem->GUIShaderGetCoord0();
- for (unsigned int i = 0; i < 4; i++)
- {
- // Setup vertex position values
- vertex[i].x = m_rotatedDestCoords[i].x;
- vertex[i].y = m_rotatedDestCoords[i].y;
- vertex[i].z = 0.0f;
- }
-
- // Setup texture coordinates
- vertex[0].u1 = vertex[3].u1 = plane.rect.x1;
- vertex[0].v1 = vertex[1].v1 = plane.rect.y1;
- vertex[1].u1 = vertex[2].u1 = plane.rect.x2;
- vertex[2].v1 = vertex[3].v1 = plane.rect.y2;
+ // top left
+ vertex[0].x = m_rotatedDestCoords[0].x;
+ vertex[0].y = m_rotatedDestCoords[0].y;
+ vertex[0].z = 0.0f;
+ vertex[0].u1 = plane.rect.x1;
+ vertex[0].v1 = plane.rect.y1;
+
+ // top right
+ vertex[1].x = m_rotatedDestCoords[1].x;
+ vertex[1].y = m_rotatedDestCoords[1].y;
+ vertex[1].z = 0.0f;
+ vertex[1].u1 = plane.rect.x2;
+ vertex[1].v1 = plane.rect.y1;
+
+ // bottom right
+ vertex[2].x = m_rotatedDestCoords[2].x;
+ vertex[2].y = m_rotatedDestCoords[2].y;
+ vertex[2].z = 0.0f;
+ vertex[2].u1 = plane.rect.x2;
+ vertex[2].v1 = plane.rect.y2;
+
+ // bottom left
+ vertex[3].x = m_rotatedDestCoords[3].x;
+ vertex[3].y = m_rotatedDestCoords[3].y;
+ vertex[3].z = 0.0f;
+ vertex[3].u1 = plane.rect.x1;
+ vertex[3].v1 = plane.rect.y2;;
glGenBuffers(1, &vertexVBO);
glBindBuffer(GL_ARRAY_BUFFER, vertexVBO);
- glBufferData(GL_ARRAY_BUFFER, sizeof(PackedVertex)*4, &vertex[0], GL_STATIC_DRAW);
+ glBufferData(GL_ARRAY_BUFFER, sizeof(PackedVertex) * vertex.size(), vertex.data(), GL_STATIC_DRAW);
glVertexAttribPointer(vertLoc, 3, GL_FLOAT, 0, sizeof(PackedVertex), reinterpret_cast<const GLvoid*>(offsetof(PackedVertex, x)));
glVertexAttribPointer(loc, 2, GL_FLOAT, 0, sizeof(PackedVertex), reinterpret_cast<const GLvoid*>(offsetof(PackedVertex, u1)));
@@ -188,7 +204,7 @@ bool CRendererDRMPRIMEGLES::RenderHook(int index)
glGenBuffers(1, &indexVBO);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, indexVBO);
- glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(GLubyte)*4, idx, GL_STATIC_DRAW);
+ glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(GLubyte) * 4, idx, GL_STATIC_DRAW);
glDrawElements(GL_TRIANGLE_STRIP, 4, GL_UNSIGNED_BYTE, 0);
From 8d4e4760cb92c90b56aa28a9260d364cd40e0245 Mon Sep 17 00:00:00 2001
From: Lukas Rusak <lorusak@gmail.com>
Date: Mon, 18 Feb 2019 19:20:11 -0800
Subject: [PATCH 4/4] CRendererDRMPRIMEGLES: add override methods for
ERENDERFEATURE and ESCALINGMETHOD
---
.../HwDecRender/RendererDRMPRIMEGLES.cpp | 24 +++++++++++++++++++
.../HwDecRender/RendererDRMPRIMEGLES.h | 3 +++
2 files changed, 27 insertions(+)
diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererDRMPRIMEGLES.cpp b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererDRMPRIMEGLES.cpp
index 1f3176422885..ac01d52c10d7 100644
--- a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererDRMPRIMEGLES.cpp
+++ b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererDRMPRIMEGLES.cpp
@@ -227,3 +227,27 @@ void CRendererDRMPRIMEGLES::AfterRenderHook(int index)
{
m_fences[index]->CreateFence();
}
+
+bool CRendererDRMPRIMEGLES::Supports(ERENDERFEATURE feature)
+{
+ if (feature == RENDERFEATURE_STRETCH ||
+ feature == RENDERFEATURE_ZOOM ||
+ feature == RENDERFEATURE_VERTICAL_SHIFT ||
+ feature == RENDERFEATURE_PIXEL_RATIO ||
+ feature == RENDERFEATURE_ROTATION)
+ {
+ return true;
+ }
+
+ return false;
+}
+
+bool CRendererDRMPRIMEGLES::Supports(ESCALINGMETHOD method)
+{
+ if (method == VS_SCALINGMETHOD_LINEAR)
+ {
+ return true;
+ }
+
+ return false;
+}
diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererDRMPRIMEGLES.h b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererDRMPRIMEGLES.h
index 1666f70443ac..4e9ae779daf8 100644
--- a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererDRMPRIMEGLES.h
+++ b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/RendererDRMPRIMEGLES.h
@@ -31,6 +31,9 @@ class CRendererDRMPRIMEGLES : public CLinuxRendererGLES
void ReleaseBuffer(int index) override;
bool NeedBuffer(int index) override;
+ bool Supports(ERENDERFEATURE feature) override;
+ bool Supports(ESCALINGMETHOD method) override;
+
protected:
// CLinuxRendererGLES overrides
bool LoadShadersHook() override;

View File

@ -0,0 +1,65 @@
From 2104dbd5e263b9f83c0e6cd451a486d6f3046f83 Mon Sep 17 00:00:00 2001
From: Lukas Rusak <lorusak@gmail.com>
Date: Sat, 20 Apr 2019 12:01:19 -0700
Subject: [PATCH] CDRMUtils: fallback to drmModeAddFB2 if
drmModeAddFB2WithModifiers fails
---
xbmc/windowing/gbm/DRMUtils.cpp | 43 +++++++++++++++++++++------------
1 file changed, 28 insertions(+), 15 deletions(-)
diff --git a/xbmc/windowing/gbm/DRMUtils.cpp b/xbmc/windowing/gbm/DRMUtils.cpp
index 8e1ec9d0dcb5..6cae2176296f 100644
--- a/xbmc/windowing/gbm/DRMUtils.cpp
+++ b/xbmc/windowing/gbm/DRMUtils.cpp
@@ -117,22 +117,35 @@ drm_fb * CDRMUtils::DrmFbGetFromBo(struct gbm_bo *bo)
CLog::Log(LOGDEBUG, "CDRMUtils::{} - using modifier: {:#x}", __FUNCTION__, modifiers[0]);
}
- auto ret = drmModeAddFB2WithModifiers(m_fd,
- width,
- height,
- fb->format,
- handles,
- strides,
- offsets,
- modifiers,
- &fb->fb_id,
- flags);
+ int ret = drmModeAddFB2WithModifiers(m_fd,
+ width,
+ height,
+ fb->format,
+ handles,
+ strides,
+ offsets,
+ modifiers,
+ &fb->fb_id,
+ flags);
+
+ if(ret < 0)
+ {
+ ret = drmModeAddFB2(m_fd,
+ width,
+ height,
+ fb->format,
+ handles,
+ strides,
+ offsets,
+ &fb->fb_id,
+ flags);
- if(ret)
- {
- delete (fb);
- CLog::Log(LOGDEBUG, "CDRMUtils::%s - failed to add framebuffer", __FUNCTION__);
- return nullptr;
+ if (ret < 0)
+ {
+ delete (fb);
+ CLog::Log(LOGDEBUG, "CDRMUtils::{} - failed to add framebuffer: {} ({})", __FUNCTION__, strerror(errno), errno);
+ return nullptr;
+ }
}
gbm_bo_set_user_data(bo, fb, DrmFbDestroyCallback);

View File

@ -0,0 +1,75 @@
diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp
index e04c3c6ff6..dcf97af4ef 100644
--- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp
+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp
@@ -156,7 +156,7 @@ void CVideoBufferPoolDRMPRIME::Return(int id)
//------------------------------------------------------------------------------
CDVDVideoCodecDRMPRIME::CDVDVideoCodecDRMPRIME(CProcessInfo& processInfo)
- : CDVDVideoCodec(processInfo)
+ : CDVDVideoCodec(processInfo), m_prevTime(0), m_seeking(false)
{
m_pFrame = av_frame_alloc();
m_videoBufferPool = std::make_shared<CVideoBufferPoolDRMPRIME>();
@@ -406,6 +406,20 @@ CDVDVideoCodec::VCReturn CDVDVideoCodecDRMPRIME::GetPicture(VideoPicture* pVideo
return VC_ERROR;
}
+ if (m_prevTime && std::abs(m_prevTime - m_processInfo.GetTime()) >= 5000)
+ m_seeking = true;
+
+ m_prevTime = m_processInfo.GetTime();
+
+ // Drop frames too far away from the target time
+ if (m_seeking && std::abs(m_pFrame->pts/1000 - m_processInfo.GetTime()) >= 5000) {
+ CLog::Log(LOGDEBUG, "CDVDVideoCodecDRMPRIME::%s - Dropping pts %llu time %lld", __FUNCTION__, m_pFrame->pts/1000, m_processInfo.GetTime());
+ av_frame_unref(m_pFrame);
+ return VC_BUFFER;
+ }
+
+ m_seeking = false;
+
if (pVideoPicture->videoBuffer)
pVideoPicture->videoBuffer->Release();
pVideoPicture->videoBuffer = nullptr;
diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.h b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.h
index ffcdf1a7b6..4455280e38 100644
--- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.h
+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.h
@@ -79,4 +79,6 @@ protected:
AVCodecContext* m_pCodecContext = nullptr;
AVFrame* m_pFrame = nullptr;
std::shared_ptr<CVideoBufferPoolDRMPRIME> m_videoBufferPool;
+ int64_t m_prevTime;
+ bool m_seeking;
};
diff --git a/xbmc/cores/VideoPlayer/Process/ProcessInfo.cpp b/xbmc/cores/VideoPlayer/Process/ProcessInfo.cpp
index e8d9023a9f..4299894c00 100644
--- a/xbmc/cores/VideoPlayer/Process/ProcessInfo.cpp
+++ b/xbmc/cores/VideoPlayer/Process/ProcessInfo.cpp
@@ -635,6 +635,13 @@ bool CProcessInfo::GetVideoRender()
return m_renderVideoLayer;
}
+int64_t CProcessInfo::GetTime()
+{
+ CSingleLock lock(m_stateSection);
+
+ return m_time;
+}
+
void CProcessInfo::SetPlayTimes(time_t start, int64_t current, int64_t min, int64_t max)
{
CSingleLock lock(m_stateSection);
diff --git a/xbmc/cores/VideoPlayer/Process/ProcessInfo.h b/xbmc/cores/VideoPlayer/Process/ProcessInfo.h
index e8042c2bc2..5b4aea9b9d 100644
--- a/xbmc/cores/VideoPlayer/Process/ProcessInfo.h
+++ b/xbmc/cores/VideoPlayer/Process/ProcessInfo.h
@@ -101,6 +101,7 @@ public:
bool GetGuiRender();
void SetVideoRender(bool video);
bool GetVideoRender();
+ int64_t GetTime();
void SetPlayTimes(time_t start, int64_t current, int64_t min, int64_t max);
int64_t GetMaxTime();

View File

@ -0,0 +1,36 @@
From 1667f2b95424f7c42fbd5b30aaadef53ab76e3ad Mon Sep 17 00:00:00 2001
From: Lukas Rusak <lorusak@gmail.com>
Date: Fri, 12 Apr 2019 22:22:34 -0700
Subject: [PATCH] CWinSystemGbm: only lock the front buffer if something is
rendered
---
xbmc/windowing/gbm/WinSystemGbm.cpp | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/xbmc/windowing/gbm/WinSystemGbm.cpp b/xbmc/windowing/gbm/WinSystemGbm.cpp
index 4a3291a55045..5cee802be2de 100644
--- a/xbmc/windowing/gbm/WinSystemGbm.cpp
+++ b/xbmc/windowing/gbm/WinSystemGbm.cpp
@@ -207,11 +207,19 @@ void CWinSystemGbm::FlipPage(bool rendered, bool videoLayer)
m_videoLayerBridge->Disable();
}
- struct gbm_bo *bo = m_GBM->LockFrontBuffer();
+ struct gbm_bo *bo = nullptr;
+
+ if (rendered)
+ {
+ bo = m_GBM->LockFrontBuffer();
+ }
m_DRM->FlipPage(bo, rendered, videoLayer);
- m_GBM->ReleaseBuffer();
+ if (rendered)
+ {
+ m_GBM->ReleaseBuffer();
+ }
if (m_videoLayerBridge && !videoLayer)
{

View File

@ -0,0 +1,153 @@
From 7a88b0ad7a90a8ac2266f87ccb08dca5df0c0867 Mon Sep 17 00:00:00 2001
From: Jonas Karlman <jonas@kwiboo.se>
Date: Sun, 14 Oct 2018 14:20:03 +0200
Subject: [PATCH] WIP: windowing/gbm: add option to limit gui size
---
.../resources/strings.po | 52 ++++++++++++++++++-
system/settings/gbm.xml | 15 ++++++
xbmc/windowing/gbm/DRMUtils.cpp | 28 ++++++++++
3 files changed, 94 insertions(+), 1 deletion(-)
diff --git a/addons/resource.language.en_gb/resources/strings.po b/addons/resource.language.en_gb/resources/strings.po
index 97211d3b718a..eaa5b3fed759 100644
--- a/addons/resource.language.en_gb/resources/strings.po
+++ b/addons/resource.language.en_gb/resources/strings.po
@@ -7256,7 +7256,57 @@ msgctxt "#13465"
msgid "EGL"
msgstr ""
-#empty strings from id 13466 to 13504
+#empty strings from id 13466 to 13485
+
+#. String for options 3 of setting with label #13482 "HDMI Quantization Range"
+#: system/settings/gbm.xml
+msgctxt "#13486"
+msgid "Limited"
+msgstr ""
+
+#. Option for setting Limit GUI Size
+#: system/settings/gbm.xml
+msgctxt "#13487"
+msgid "Limit GUI Size"
+msgstr ""
+
+#. Description of setting with label #13487 "Limit GUI Size"
+#: system/settings/gbm.xml
+msgctxt "#13488"
+msgid "This option limits GUI size for screen resolutions above 1080p. Requires restart."
+msgstr ""
+
+#. String for options 1 of setting with label #13487 "Limit GUI Size"
+#: system/settings/gbm.xml
+msgctxt "#13489"
+msgid "No limit"
+msgstr ""
+
+#. String for options 2 of setting with label #13487 "Limit GUI Size"
+#: system/settings/gbm.xml
+msgctxt "#13490"
+msgid "720p"
+msgstr ""
+
+#. String for options 3 of setting with label #13487 "Limit GUI Size"
+#: system/settings/gbm.xml
+msgctxt "#13491"
+msgid "1080p / 720p (>30hz)"
+msgstr ""
+
+#. String for options 4 of setting with label #13487 "Limit GUI Size"
+#: system/settings/gbm.xml
+msgctxt "#13492"
+msgid "1080p"
+msgstr ""
+
+#. String for options 5 of setting with label #13487 "Limit GUI Size"
+#: system/settings/gbm.xml
+msgctxt "#13493"
+msgid "No limit / 1080p (>30hz)"
+msgstr ""
+
+#empty strings from id 13494 to 13504
#: system/settings/settings.xml
msgctxt "#13505"
diff --git a/system/settings/gbm.xml b/system/settings/gbm.xml
index c5e4d98e0bef..830576c156a6 100644
--- a/system/settings/gbm.xml
+++ b/system/settings/gbm.xml
@@ -41,6 +41,21 @@
<setting id="videoscreen.screen">
<visible>false</visible>
</setting>
+ <setting id="videoscreen.limitguisize" type="integer" label="13487" help="13488">
+ <visible>false</visible>
+ <level>3</level>
+ <default>0</default>
+ <constraints>
+ <options>
+ <option label="13489">0</option> <!-- No limit -->
+ <option label="13490">1</option> <!-- 720p -->
+ <option label="13491">2</option> <!-- 1080p / 720p (>30hz) -->
+ <option label="13492">3</option> <!-- 1080p -->
+ <option label="13493">4</option> <!-- No limit / 1080p (>30hz) -->
+ </options>
+ </constraints>
+ <control type="list" format="string" />
+ </setting>
<setting id="videoscreen.limitedrange" type="boolean" label="36042" help="36359">
<level>3</level>
<default>false</default>
diff --git a/xbmc/windowing/gbm/DRMUtils.cpp b/xbmc/windowing/gbm/DRMUtils.cpp
index fceaf770d363..21a6f8f1b926 100644
--- a/xbmc/windowing/gbm/DRMUtils.cpp
+++ b/xbmc/windowing/gbm/DRMUtils.cpp
@@ -17,6 +17,8 @@
#include <unistd.h>
#include "platform/linux/XTimeUtils.h"
+#include "settings/Settings.h"
+#include "settings/SettingsComponent.h"
#include "utils/log.h"
#include "utils/StringUtils.h"
#include "windowing/GraphicContext.h"
@@ -25,6 +27,8 @@
using namespace KODI::WINDOWING::GBM;
+const std::string SETTING_VIDEOSCREEN_LIMITGUISIZE = "videoscreen.limitguisize";
+
CDRMUtils::CDRMUtils()
: m_connector(new connector)
, m_encoder(new encoder)
@@ -731,6 +735,30 @@ RESOLUTION_INFO CDRMUtils::GetResolutionInfo(drmModeModeInfoPtr mode)
res.iWidth = res.iScreenWidth;
res.iHeight = res.iScreenHeight;
+ int limit = CServiceBroker::GetSettingsComponent()->GetSettings()->GetInt(SETTING_VIDEOSCREEN_LIMITGUISIZE);
+ if (limit > 0 && res.iScreenWidth > 1920 && res.iScreenHeight > 1080)
+ {
+ switch (limit)
+ {
+ case 1:
+ res.iWidth = 1280;
+ res.iHeight = 720;
+ break;
+ case 2:
+ res.iWidth = mode->vrefresh > 30 ? 1280 : 1920;
+ res.iHeight = mode->vrefresh > 30 ? 720 : 1080;
+ break;
+ case 3:
+ res.iWidth = 1920;
+ res.iHeight = 1080;
+ break;
+ case 4:
+ res.iWidth = mode->vrefresh > 30 ? 1920 : res.iScreenWidth;
+ res.iHeight = mode->vrefresh > 30 ? 1080 : res.iScreenHeight;
+ break;
+ }
+ }
+
if (mode->clock % 5 != 0)
res.fRefreshRate = static_cast<float>(mode->vrefresh) * (1000.0f/1001.0f);
else

View File

@ -0,0 +1,11 @@
### A
https://github.com/torvalds/linux/compare/v5.1...superna9999:linux-5.1-le-amlogic-v2.patch
### C
** from rockchip-5.1-patches-for-libreelec-v5.1 branch, remove 09/16 **
https://github.com/Kwiboo/linux-rockchip/compare/43e542a1432b200f589e589320a885b5640d1f45...d6b6f0ca3df105f4d84b7cbaca8e5a3cfbf2ad42
### E-F
** misc patches to go upstream **

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,28 @@
From 78a5fa8623ffbc3a4f661d42aaea172c7d80cc9d Mon Sep 17 00:00:00 2001
From: chewitt <github@chrishewitt.net>
Date: Sat, 13 Apr 2019 05:41:51 +0000
Subject: [PATCH 01/37] HACK: set cma pool to 896MB
This change sets the CMA pool to a larger 896MB! value for (WIP) vdec use
Signed-off-by: Christian Hewitt <christianshewitt@gmail.com>
---
arch/arm64/boot/dts/amlogic/meson-gx.dtsi | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm64/boot/dts/amlogic/meson-gx.dtsi b/arch/arm64/boot/dts/amlogic/meson-gx.dtsi
index 8238f55666e7..46cb715de241 100644
--- a/arch/arm64/boot/dts/amlogic/meson-gx.dtsi
+++ b/arch/arm64/boot/dts/amlogic/meson-gx.dtsi
@@ -44,7 +44,7 @@
linux,cma {
compatible = "shared-dma-pool";
reusable;
- size = <0x0 0x10000000>;
+ size = <0x0 0x38000000>;
alignment = <0x0 0x400000>;
linux,cma-default;
};
--
2.17.1

View File

@ -0,0 +1,31 @@
From 42a2fa4e82892cb9089b6870f41dc84c595f8df4 Mon Sep 17 00:00:00 2001
From: chewitt <github@chrishewitt.net>
Date: Sat, 13 Apr 2019 05:45:18 +0000
Subject: [PATCH 02/37] HACK: fix Kodi sysinfo CPU information
This allows the CPU information to show in the Kodi sysinfo screen, e.g.
"ARMv8 Processor rev 4 (v81)" on S905* devices
Signed-off-by: Christian Hewitt <christianshewitt@gmail.com>
---
arch/arm64/kernel/cpuinfo.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/arch/arm64/kernel/cpuinfo.c b/arch/arm64/kernel/cpuinfo.c
index ca0685f33900..e1a26a315733 100644
--- a/arch/arm64/kernel/cpuinfo.c
+++ b/arch/arm64/kernel/cpuinfo.c
@@ -140,8 +140,7 @@ static int c_show(struct seq_file *m, void *v)
* "processor". Give glibc what it expects.
*/
seq_printf(m, "processor\t: %d\n", i);
- if (compat)
- seq_printf(m, "model name\t: ARMv8 Processor rev %d (%s)\n",
+ seq_printf(m, "model name\t: ARMv8 Processor rev %d (%s)\n",
MIDR_REVISION(midr), COMPAT_ELF_PLATFORM);
seq_printf(m, "BogoMIPS\t: %lu.%02lu\n",
--
2.17.1

View File

@ -0,0 +1,29 @@
From 2585e9b6e91d529c2ac27133f1219761726a643c Mon Sep 17 00:00:00 2001
From: chewitt <github@chrishewitt.net>
Date: Sat, 13 Apr 2019 06:27:33 +0000
Subject: [PATCH 04/37] HACK: silence meson-ir warn once log spam
This silences another warning message that spams the system log.
Signed-off-by: Christian Hewitt <christianshewitt@gmail.com>
---
drivers/media/rc/meson-ir.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/media/rc/meson-ir.c b/drivers/media/rc/meson-ir.c
index 9914c83fecb9..ba2f3fb92889 100644
--- a/drivers/media/rc/meson-ir.c
+++ b/drivers/media/rc/meson-ir.c
@@ -97,7 +97,8 @@ static irqreturn_t meson_ir_irq(int irqno, void *dev_id)
status = readl_relaxed(ir->reg + IR_DEC_STATUS);
rawir.pulse = !!(status & STATUS_IR_DEC_IN);
- ir_raw_event_store_with_timeout(ir->rc, &rawir);
+ if (ir_raw_event_store_with_filter(ir->rc, &rawir))
+ ir_raw_event_handle(ir->rc);
spin_unlock(&ir->lock);
--
2.17.1

View File

@ -0,0 +1,28 @@
From 48b392bb606eb916a0a2fc0a3d318c4bde92bd2b Mon Sep 17 00:00:00 2001
From: chewitt <github@chrishewitt.net>
Date: Sat, 13 Apr 2019 06:35:17 +0000
Subject: [PATCH 05/37] HACK: silence hrtimer log spam
This silences another annoying system log message
Signed-off-by: Christian Hewitt <christianshewitt@gmail.com>
---
kernel/time/hrtimer.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c
index 41dfff23c1f9..bb6d137388ca 100644
--- a/kernel/time/hrtimer.c
+++ b/kernel/time/hrtimer.c
@@ -905,7 +905,7 @@ u64 hrtimer_forward(struct hrtimer *timer, ktime_t now, ktime_t interval)
if (delta < 0)
return 0;
- if (WARN_ON(timer->state & HRTIMER_STATE_ENQUEUED))
+ if (timer->state & HRTIMER_STATE_ENQUEUED)
return 0;
if (interval < hrtimer_resolution)
--
2.17.1

View File

@ -0,0 +1,37 @@
From e0f59e98b6603924e5b44a276a6939b7893c86e1 Mon Sep 17 00:00:00 2001
From: Szymon Janc <szymon.janc@xxxxxxxxxxx>
Date: Thu, 29 Mar 2018 11:41:17 +0200
Subject: [PATCH 06/37] HACK: Bluetooth: Fix spurious error message
This message was debug message before 2064ee332e4c1b7495cf68b. Looks
like it was changed by accident in that patch. This is causing some
error messages when doing BR/EDR discovery since Inquiry Command
generates Command Status event, not Command Complete.
I'm sending this as RFC for now since while things seem to work fine
despite this condition (and it was like that for quite some time) it
feels like this is indeed case that should be handled by HCI request
code.
Signed-off-by: Szymon Janc <szymon.janc@xxxxxxxxxxx>
---
net/bluetooth/hci_event.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index 609fd6871c5a..3cac7023aa95 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -5718,8 +5718,7 @@ static bool hci_get_cmd_complete(struct hci_dev *hdev, u16 opcode,
return false;
if (hdr->evt != HCI_EV_CMD_COMPLETE) {
- bt_dev_err(hdev, "last event is not cmd complete (0x%2.2x)",
- hdr->evt);
+ BT_DBG("last event is not cmd complete (0x%2.2x)", hdr->evt);
return false;
}
--
2.17.1

View File

@ -0,0 +1,255 @@
From d724c862a105e5921abf71275d1e250bb4331a3d Mon Sep 17 00:00:00 2001
From: chewitt <github@chrishewitt.net>
Date: Sat, 13 Apr 2019 06:18:39 +0000
Subject: [PATCH 11/37] arm64: dts: meson-gxbb-vega-s95: update dtsi with many
changes
Signed-off-by: Christian Hewitt <christianshewitt@gmail.com>
---
.../boot/dts/amlogic/meson-gxbb-vega-s95.dtsi | 133 ++++++++++++++++--
1 file changed, 119 insertions(+), 14 deletions(-)
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-vega-s95.dtsi b/arch/arm64/boot/dts/amlogic/meson-gxbb-vega-s95.dtsi
index d8c262b9be01..58aaa196d576 100644
--- a/arch/arm64/boot/dts/amlogic/meson-gxbb-vega-s95.dtsi
+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-vega-s95.dtsi
@@ -4,12 +4,15 @@
*/
#include "meson-gxbb.dtsi"
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
/ {
compatible = "tronsmart,vega-s95", "amlogic,meson-gxbb";
aliases {
serial0 = &uart_AO;
+ serial1 = &uart_A;
ethernet0 = &ethmac;
};
@@ -28,10 +31,10 @@
};
};
- usb_vbus: regulator-usb0-vbus {
+ usb_pwr: regulator-usb-pwrs {
compatible = "regulator-fixed";
- regulator-name = "USB0_VBUS";
+ regulator-name = "USB_PWR";
regulator-min-microvolt = <5000000>;
regulator-max-microvolt = <5000000>;
@@ -40,20 +43,34 @@
enable-active-high;
};
- vcc_3v3: regulator-vcc_3v3 {
+ vddio_boot: regulator-vddio_boot {
compatible = "regulator-fixed";
- regulator-name = "VCC_3V3";
+ regulator-name = "VDDIO_BOOT";
+ regulator-min-microvolt = <1800000>;
+ regulator-max-microvolt = <1800000>;
+ };
+
+ vddao_3v3: regulator-vddao_3v3 {
+ compatible = "regulator-fixed";
+ regulator-name = "VDDAO_3V3";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
};
- vcc_1v8: regulator-vcc_1v8 {
+ vddio_ao18: regulator-vddio_ao18 {
compatible = "regulator-fixed";
- regulator-name = "VCC_1V8";
+ regulator-name = "VDDIO_AO18";
regulator-min-microvolt = <1800000>;
regulator-max-microvolt = <1800000>;
};
+ vcc_3v3: regulator-vcc_3v3 {
+ compatible = "regulator-fixed";
+ regulator-name = "VCC_3V3";
+ regulator-min-microvolt = <3300000>;
+ regulator-max-microvolt = <3300000>;
+ };
+
emmc_pwrseq: emmc-pwrseq {
compatible = "mmc-pwrseq-emmc";
reset-gpios = <&gpio BOOT_9 GPIO_ACTIVE_LOW>;
@@ -66,15 +83,69 @@
pwms = <&pwm_ef 0 30518 0>; /* PWM_E at 32.768KHz */
};
+ hdmi-connector {
+ compatible = "hdmi-connector";
+ type = "a";
+
+ port {
+ hdmi_connector_in: endpoint {
+ remote-endpoint = <&hdmi_tx_tmds_out>;
+ };
+ };
+ };
+
+ sound {
+ compatible = "simple-audio-card";
+ simple-audio-card,name = "HDMI";
+
+ assigned-clocks = <&clkc CLKID_MPLL2>,
+ <&clkc CLKID_MPLL0>,
+ <&clkc CLKID_MPLL1>;
+ assigned-clock-parents = <0>, <0>, <0>;
+ assigned-clock-rates = <294912000>,
+ <270950400>,
+ <393216000>;
+
+ simple-audio-card,dai-link@0 {
+ /* HDMI Output */
+ format = "i2s";
+ mclk-fs = <128>;
+ bitclock-master = <&aiu_i2s>;
+ frame-master = <&aiu_i2s>;
+
+ cpu {
+ sound-dai = <&aiu_i2s>;
+ };
+
+ codec {
+ sound-dai = <&hdmi_tx>;
+ };
+ };
+ };
+
sdio_pwrseq: sdio-pwrseq {
compatible = "mmc-pwrseq-simple";
- reset-gpios = <&gpio GPIOX_6 GPIO_ACTIVE_LOW>,
- <&gpio GPIOX_20 GPIO_ACTIVE_LOW>;
+ reset-gpios = <&gpio GPIOX_6 GPIO_ACTIVE_LOW>;
clocks = <&wifi32k>;
clock-names = "ext_clock";
};
};
+&audio {
+ status = "okay";
+};
+
+&aiu_i2s {
+ status = "okay";
+};
+
+&cec_AO {
+ status = "okay";
+ pinctrl-0 = <&ao_cec_pins>;
+ pinctrl-names = "default";
+ hdmi-phandle = <&hdmi_tx>;
+};
+
&ethmac {
status = "okay";
pinctrl-0 = <&eth_rgmii_pins>;
@@ -97,10 +168,25 @@
eth_phy0: ethernet-phy@0 {
/* Realtek RTL8211F (0x001cc916) */
reg = <0>;
+ interrupt-parent = <&gpio_intc>;
+ /* MAC_INTR on GPIOZ_15 */
+ interrupts = <29 IRQ_TYPE_LEVEL_LOW>;
};
};
};
+&hdmi_tx {
+ status = "okay";
+ pinctrl-0 = <&hdmi_hpd_pins>, <&hdmi_i2c_pins>;
+ pinctrl-names = "default";
+};
+
+&hdmi_tx_tmds_port {
+ hdmi_tx_tmds_out: endpoint {
+ remote-endpoint = <&hdmi_connector_in>;
+ };
+};
+
&ir {
status = "okay";
pinctrl-0 = <&remote_input_ao_pins>;
@@ -115,10 +201,15 @@
clock-names = "clkin0";
};
+&saradc {
+ status = "okay";
+ vref-supply = <&vddio_ao18>;
+};
+
/* Wireless SDIO Module */
&sd_emmc_a {
status = "okay";
- pinctrl-0 = <&sdio_pins &sdio_irq_pins>;
+ pinctrl-0 = <&sdio_pins>;
pinctrl-1 = <&sdio_clk_gate_pins>;
pinctrl-names = "default", "clk-gate";
#address-cells = <1>;
@@ -133,8 +224,8 @@
mmc-pwrseq = <&sdio_pwrseq>;
- vmmc-supply = <&vcc_3v3>;
- vqmmc-supply = <&vcc_1v8>;
+ vmmc-supply = <&vddao_3v3>;
+ vqmmc-supply = <&vddio_boot>;
brcmf: wifi@1 {
reg = <1>;
@@ -156,7 +247,8 @@
cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_LOW>;
- vmmc-supply = <&vcc_3v3>;
+ vmmc-supply = <&vddao_3v3>;
+ vqmmc-supply = <&vcc_3v3>;
};
/* eMMC */
@@ -176,9 +268,22 @@
mmc-pwrseq = <&emmc_pwrseq>;
vmmc-supply = <&vcc_3v3>;
- vmmcq-sumpply = <&vcc_1v8>;
+ vqmmc-supply = <&vddio_boot>;
+};
+
+/* This is connected to the Bluetooth module: */
+&uart_A {
+ status = "okay";
+ pinctrl-0 = <&uart_a_pins>, <&uart_a_cts_rts_pins>;
+ pinctrl-names = "default";
+
+ bluetooth {
+ compatible = "brcm,bcm43438-bt";
+ shutdown-gpios = <&gpio GPIOX_20 GPIO_ACTIVE_HIGH>;
+ };
};
+/* This UART is brought out to the DB9 connector */
&uart_AO {
status = "okay";
pinctrl-0 = <&uart_ao_a_pins>;
@@ -187,7 +292,7 @@
&usb0_phy {
status = "okay";
- phy-supply = <&usb_vbus>;
+ phy-supply = <&usb_pwr>;
};
&usb1_phy {
--
2.17.1

View File

@ -0,0 +1,50 @@
From ecffab2a2ca4471b37d984bda5c356ed811c46c1 Mon Sep 17 00:00:00 2001
From: chewitt <github@chrishewitt.net>
Date: Sat, 13 Apr 2019 06:50:48 +0000
Subject: [PATCH 12/37] arm64: dts: meson-gxbb-wetek.dtsi: enable bluetooth
This enables Bluetooth support for the following models:
AP6335 in the WeTek Hub rev1 - BCM4335C0.hcd
AP6255 in the WeTek Hub rev2 - BCM4345C0.hcd
AP6330 in the WeTek Play 2 - BCM4330B1.hcd (TBC)
Signed-off-by: Christian Hewitt <christianshewitt@gmail.com>
---
arch/arm64/boot/dts/amlogic/meson-gxbb-wetek.dtsi | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek.dtsi b/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek.dtsi
index ff9b182afac7..5cdca2eed7d9 100644
--- a/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek.dtsi
+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek.dtsi
@@ -10,6 +10,7 @@
/ {
aliases {
serial0 = &uart_AO;
+ serial1 = &uart_A;
ethernet0 = &ethmac;
};
@@ -274,6 +275,18 @@
vqmmc-supply = <&vddio_boot>;
};
+/* This is connected to the Bluetooth module: */
+&uart_A {
+ status = "okay";
+ pinctrl-0 = <&uart_a_pins>, <&uart_a_cts_rts_pins>;
+ pinctrl-names = "default";
+
+ bluetooth {
+ compatible = "brcm,bcm43438-bt";
+ shutdown-gpios = <&gpio GPIOX_20 GPIO_ACTIVE_HIGH>;
+ };
+};
+
/* This UART is brought out to the DB9 connector */
&uart_AO {
status = "okay";
--
2.17.1

View File

@ -0,0 +1,43 @@
From 17bb4637c8f9a78cab585b9f0d55960784fb90ed Mon Sep 17 00:00:00 2001
From: chewitt <github@chrishewitt.net>
Date: Sat, 13 Apr 2019 06:58:59 +0000
Subject: [PATCH 13/37] arm64: dts: meson-gxbb-wetek.dtsi: enable saradc node
Signed-off-by: Christian Hewitt <christianshewitt@gmail.com>
---
arch/arm64/boot/dts/amlogic/meson-gxbb-wetek.dtsi | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek.dtsi b/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek.dtsi
index 5cdca2eed7d9..e7d27daa1357 100644
--- a/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek.dtsi
+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek.dtsi
@@ -60,6 +60,13 @@
regulator-max-microvolt = <3300000>;
};
+ vddio_ao18: regulator-vddio_ao18 {
+ compatible = "regulator-fixed";
+ regulator-name = "VDDIO_AO18";
+ regulator-min-microvolt = <1800000>;
+ regulator-max-microvolt = <1800000>;
+ };
+
vcc_3v3: regulator-vcc_3v3 {
compatible = "regulator-fixed";
regulator-name = "VCC_3V3";
@@ -210,6 +217,11 @@
clock-names = "clkin0";
};
+&saradc {
+ status = "okay";
+ vref-supply = <&vddio_ao18>;
+};
+
/* Wireless SDIO Module */
&sd_emmc_a {
status = "okay";
--
2.17.1

View File

@ -0,0 +1,30 @@
From eff5b2f4af16279259e7dbb2b61b915f5dc1f519 Mon Sep 17 00:00:00 2001
From: chewitt <github@chrishewitt.net>
Date: Wed, 24 Apr 2019 03:40:16 +0000
Subject: [PATCH 15/37] arm64: dts: meson-gxbb-odroid: set blue led to on
The constantly flashing blue LED heartbeat is annoying for an HTPC device
so remove the heartbeat and simply default to on.
Signed-off-by: Christian Hewitt <christianshewitt@gmail.com>
---
arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts b/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts
index 80a7d47160e9..88816c20800f 100644
--- a/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts
+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts
@@ -45,8 +45,7 @@
blue {
label = "c2:blue:alive";
gpios = <&gpio_ao GPIOAO_13 GPIO_ACTIVE_LOW>;
- linux,default-trigger = "heartbeat";
- default-state = "off";
+ default-state = "on";
};
};
--
2.17.1

View File

@ -0,0 +1,25 @@
From dd2f7889db3a060d67849344d33ed0693fdd3aef Mon Sep 17 00:00:00 2001
From: chewitt <github@chrishewitt.net>
Date: Wed, 24 Apr 2019 03:26:16 +0000
Subject: [PATCH 16/37] arm64: dts: meson-gxbb-odroid: set rc-odroid ir keymap
Signed-off-by: Christian Hewitt <christianshewitt@gmail.com>
---
arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts b/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts
index 88816c20800f..723cd5a114aa 100644
--- a/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts
+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts
@@ -220,6 +220,7 @@
status = "okay";
pinctrl-0 = <&remote_input_ao_pins>;
pinctrl-names = "default";
+ linux,rc-map-name = "rc-odroid";
};
&gpio_ao {
--
2.17.1

View File

@ -0,0 +1,26 @@
From 761f9019c724644a2b41f7860182429f96eecdae Mon Sep 17 00:00:00 2001
From: chewitt <github@chrishewitt.net>
Date: Fri, 26 Apr 2019 08:43:58 +0000
Subject: [PATCH 17/37] arm64: dts: meson-gxbb-vega-s95: set rc-vega-s95 ir
keymap
Signed-off-by: Christian Hewitt <christianshewitt@gmail.com>
---
arch/arm64/boot/dts/amlogic/meson-gxbb-vega-s95.dtsi | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-vega-s95.dtsi b/arch/arm64/boot/dts/amlogic/meson-gxbb-vega-s95.dtsi
index 58aaa196d576..795a1e78873d 100644
--- a/arch/arm64/boot/dts/amlogic/meson-gxbb-vega-s95.dtsi
+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-vega-s95.dtsi
@@ -191,6 +191,7 @@
status = "okay";
pinctrl-0 = <&remote_input_ao_pins>;
pinctrl-names = "default";
+ linux,rc-map-name = "rc-vega-s95";
};
&pwm_ef {
--
2.17.1

View File

@ -0,0 +1,26 @@
From 7d2742b632882567076501490110d92d7fad8d4e Mon Sep 17 00:00:00 2001
From: chewitt <github@chrishewitt.net>
Date: Mon, 15 Apr 2019 04:40:25 +0000
Subject: [PATCH 18/37] arm64: dts: meson-gxbb-wetek-hub: set rc-wetek-hub ir
keymap
Signed-off-by: Christian Hewitt <christianshewitt@gmail.com>
---
arch/arm64/boot/dts/amlogic/meson-gxbb-wetek-hub.dts | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek-hub.dts b/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek-hub.dts
index 2bfe69902552..83b985bb015e 100644
--- a/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek-hub.dts
+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek-hub.dts
@@ -12,3 +12,7 @@
compatible = "wetek,hub", "amlogic,meson-gxbb";
model = "WeTek Hub";
};
+
+&ir {
+ linux,rc-map-name = "rc-wetek-hub";
+};
--
2.17.1

View File

@ -0,0 +1,26 @@
From 7b15154d606081d14c64d84b61840d695fbba75c Mon Sep 17 00:00:00 2001
From: chewitt <github@chrishewitt.net>
Date: Sun, 21 Apr 2019 02:27:40 +0000
Subject: [PATCH 19/37] arm64: dts: meson-gxbb-wetek-play2: set rc-wetek-play2
ir keymap
Signed-off-by: Christian Hewitt <christianshewitt@gmail.com>
---
arch/arm64/boot/dts/amlogic/meson-gxbb-wetek-play2.dts | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek-play2.dts b/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek-play2.dts
index 0038522315de..1d32d1f6d032 100644
--- a/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek-play2.dts
+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek-play2.dts
@@ -54,3 +54,7 @@
&usb1 {
status = "okay";
};
+
+&ir {
+ linux,rc-map-name = "rc-wetek-play2";
+};
--
2.17.1

View File

@ -0,0 +1,34 @@
From 133ba868862509bcd50dfd2ebaf942552e0399b1 Mon Sep 17 00:00:00 2001
From: chewitt <github@chrishewitt.net>
Date: Mon, 29 Apr 2019 03:37:28 +0000
Subject: [PATCH 20/37] arm64: dts: meson-gxl-s905x-khadas-vim: use rc-khadas
remote not rc-geekbox
Khadas shipped the first batch of VIM devices with the 'geekbox' remote from
another of their brands. All further shipments have used a 'khadas' branded
remote that provides an Android mouse function instead of KEY_SCREEN. As the
IR keycode for the geekbox screen button is different to the khadas mouse
button KEY_SCREEN doesn't work on the Khadas remote, so swap to the rc-khadas
keymap to gain an extra button mapped to KEY_MUTE.
Signed-off-by: Christian Hewitt <christianshewitt@gmail.com>
---
arch/arm64/boot/dts/amlogic/meson-gxl-s905x-khadas-vim.dts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-khadas-vim.dts b/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-khadas-vim.dts
index b2493e9dfd08..5d87649aedf1 100644
--- a/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-khadas-vim.dts
+++ b/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-khadas-vim.dts
@@ -147,7 +147,7 @@
};
&ir {
- linux,rc-map-name = "rc-geekbox";
+ linux,rc-map-name = "rc-khadas";
};
&gpio_ao {
--
2.17.1

View File

@ -0,0 +1,33 @@
From 9f1e034f25ee294bee0a636f0b0ecd571fc40d17 Mon Sep 17 00:00:00 2001
From: chewitt <github@chrishewitt.net>
Date: Tue, 16 Apr 2019 13:06:08 +0000
Subject: [PATCH 21/37] arm64: dts: meson-gxl-s905x-khadas-vim: fix
address/size cells dtc warnings
Fix DTC warnings:
arch/arm/dts/meson-gxl-s905x-khadas-vim.dtb: Warning (avoid_unnecessary_addr_size):
/gpio-keys-polled: unnecessary #address-cells/#size-cells
without "ranges" or child "reg" property
Signed-off-by: Christian Hewitt <christianshewitt@gmail.com>
---
arch/arm64/boot/dts/amlogic/meson-gxl-s905x-khadas-vim.dts | 2 --
1 file changed, 2 deletions(-)
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-khadas-vim.dts b/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-khadas-vim.dts
index 5d87649aedf1..fccea95297e2 100644
--- a/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-khadas-vim.dts
+++ b/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-khadas-vim.dts
@@ -33,8 +33,6 @@
gpio-keys-polled {
compatible = "gpio-keys-polled";
- #address-cells = <1>;
- #size-cells = <0>;
poll-interval = <100>;
button@0 {
--
2.17.1

View File

@ -0,0 +1,26 @@
From 58677981f9e080fb42f329273e94a7e0c5d2b09b Mon Sep 17 00:00:00 2001
From: chewitt <github@chrishewitt.net>
Date: Mon, 15 Apr 2019 02:58:24 +0000
Subject: [PATCH 22/37] arm64: dts: meson-gxl-s905w-tx3-mini: set rc-tx3mini ir
keymap
Signed-off-by: Christian Hewitt <christianshewitt@gmail.com>
---
arch/arm64/boot/dts/amlogic/meson-gxl-s905w-tx3-mini.dts | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxl-s905w-tx3-mini.dts b/arch/arm64/boot/dts/amlogic/meson-gxl-s905w-tx3-mini.dts
index 789c819c99c4..dd729ac2300d 100644
--- a/arch/arm64/boot/dts/amlogic/meson-gxl-s905w-tx3-mini.dts
+++ b/arch/arm64/boot/dts/amlogic/meson-gxl-s905w-tx3-mini.dts
@@ -20,3 +20,7 @@
reg = <0x0 0x0 0x0 0x40000000>; /* 1 GiB or 2 GiB */
};
};
+
+&ir {
+ linux,rc-map-name = "rc-tanix-tx3mini";
+};
--
2.17.1

View File

@ -0,0 +1,25 @@
From 05a9bf407fae671f1994d2a4504c23093b769f9f Mon Sep 17 00:00:00 2001
From: chewitt <github@chrishewitt.net>
Date: Sat, 13 Apr 2019 08:27:53 +0000
Subject: [PATCH 23/37] arm64: dts: meson-gxm-khadas-vim2: set eee-broken-1000t
Signed-off-by: Christian Hewitt <christianshewitt@gmail.com>
---
arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts b/arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts
index b2dad05b89fe..dc6e33636082 100644
--- a/arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts
+++ b/arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts
@@ -297,6 +297,7 @@
interrupt-parent = <&gpio_intc>;
/* MAC_INTR on GPIOZ_15 */
interrupts = <25 IRQ_TYPE_LEVEL_LOW>;
+ eee-broken-1000t;
};
};
--
2.17.1

View File

@ -0,0 +1,33 @@
From 688f83acbd11367a6ced2894329c462ee5a9caa6 Mon Sep 17 00:00:00 2001
From: chewitt <github@chrishewitt.net>
Date: Tue, 16 Apr 2019 13:15:32 +0000
Subject: [PATCH 24/37] arm64: dts: meson-gxm-khadas-vim2: fix address/size
cells dtc warnings
Fix DTC warnings:
arch/arm/dts/meson-gxm-khadas-vim2.dtb: Warning (avoid_unnecessary_addr_size):
/gpio-keys-polled: unnecessary #address-cells/#size-cells
without "ranges" or child "reg" property
Signed-off-by: Christian Hewitt <christianshewitt@gmail.com>
---
arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts | 2 --
1 file changed, 2 deletions(-)
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts b/arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts
index dc6e33636082..79981bf85678 100644
--- a/arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts
+++ b/arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts
@@ -63,8 +63,6 @@
gpio-keys-polled {
compatible = "gpio-keys-polled";
- #address-cells = <1>;
- #size-cells = <0>;
poll-interval = <100>;
button@0 {
--
2.17.1

View File

@ -0,0 +1,33 @@
From 10508df1fa03e4a4f3e46d3b3d3dcc2d29e15281 Mon Sep 17 00:00:00 2001
From: chewitt <github@chrishewitt.net>
Date: Wed, 24 Apr 2019 13:58:32 +0000
Subject: [PATCH 25/37] arm64: dts: meson-gxm-khadas-vim2: set bt compatible
Signed-off-by: Christian Hewitt <christianshewitt@gmail.com>
---
arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts b/arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts
index 79981bf85678..a4ab5615a603 100644
--- a/arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts
+++ b/arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts
@@ -440,8 +440,14 @@
/* This one is connected to the Bluetooth module */
&uart_A {
status = "okay";
- pinctrl-0 = <&uart_a_pins>;
+ pinctrl-0 = <&uart_a_pins>, <&uart_a_cts_rts_pins>;
pinctrl-names = "default";
+ uart-has-rtscts;
+
+ bluetooth {
+ compatible = "brcm,bcm43438-bt";
+ shutdown-gpios = <&gpio GPIOX_17 GPIO_ACTIVE_HIGH>;
+ };
};
/* This is brought out on the Linux_RX (18) and Linux_TX (19) pins: */
--
2.17.1

View File

@ -0,0 +1,31 @@
From ee8c2d72348e6e882775bafb7e1e2a6c6bcdd0ad Mon Sep 17 00:00:00 2001
From: chewitt <github@chrishewitt.net>
Date: Fri, 26 Apr 2019 08:47:22 +0000
Subject: [PATCH 26/37] arm64: dts: meson-gxm-vega-s96: set rc-vega-s95 ir
keymap
S96 uses the same remote as the S95 series devices.
Signed-off-by: Christian Hewitt <christianshewitt@gmail.com>
---
arch/arm64/boot/dts/amlogic/meson-gxm-vega-s96.dts | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxm-vega-s96.dts b/arch/arm64/boot/dts/amlogic/meson-gxm-vega-s96.dts
index e2ea6753263b..c25fd80b14bf 100644
--- a/arch/arm64/boot/dts/amlogic/meson-gxm-vega-s96.dts
+++ b/arch/arm64/boot/dts/amlogic/meson-gxm-vega-s96.dts
@@ -35,3 +35,10 @@
reg = <0>;
};
};
+
+&ir {
+ status = "okay";
+ pinctrl-0 = <&remote_input_ao_pins>;
+ pinctrl-names = "default";
+ linux,rc-map-name = "rc-vega-s95";
+};
--
2.17.1

View File

@ -0,0 +1,100 @@
From 529ed7f6209726674fa4a17de1ce30e958bc720d Mon Sep 17 00:00:00 2001
From: Christian Hewitt <christianshewitt@gmail.com>
Date: Mon, 1 Apr 2019 04:22:30 +0400
Subject: [PATCH 27/37] media: rc: add keymap for HardKernel ODROID remote
This is a simple NEC remote controll device shipped with the HardKernel
ODROID range of ARM Single Board Computer (SBC) devices.
Signed-off-by: Christian Hewitt <christianshewitt@gmail.com>
---
drivers/media/rc/keymaps/Makefile | 1 +
drivers/media/rc/keymaps/rc-odroid.c | 51 ++++++++++++++++++++++++++++
include/media/rc-map.h | 1 +
3 files changed, 53 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 5b1399af6b3a..03fbac32befb 100644
--- a/drivers/media/rc/keymaps/Makefile
+++ b/drivers/media/rc/keymaps/Makefile
@@ -75,6 +75,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-pinnacle-color.o \
rc-pinnacle-grey.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..e95aab608c5a
--- /dev/null
+++ b/drivers/media/rc/keymaps/rc-odroid.c
@@ -0,0 +1,51 @@
+// SPDX-License-Identifier: GPL-2.0+
+//
+// Copyright (C) 2019 Christian Hewitt <christianshewitt@gmail.com>
+
+#include <media/rc-map.h>
+#include <linux/module.h>
+
+//
+// Keytable for the HardKernel ODROID remote controller
+//
+
+static struct rc_map_table odroid[] = {
+
+ { 0xb2dc, KEY_POWER },
+ { 0xb288, KEY_MUTE },
+ { 0xb282, KEY_HOME },
+ { 0xb2ca, KEY_UP },
+ { 0xb299, KEY_LEFT },
+ { 0xb2ce, KEY_OK },
+ { 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_proto = RC_PROTO_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("Christian Hewitt <christianshewitt@gmail.com");
diff --git a/include/media/rc-map.h b/include/media/rc-map.h
index 5e684bb0d64c..771e9e2cca50 100644
--- a/include/media/rc-map.h
+++ b/include/media/rc-map.h
@@ -243,6 +243,7 @@ struct rc_map *rc_map_get(const char *name);
#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_PINNACLE_COLOR "rc-pinnacle-color"
#define RC_MAP_PINNACLE_GREY "rc-pinnacle-grey"
--
2.17.1

View File

@ -0,0 +1,111 @@
From fab0eea0158005f99cc6fdf380a9a436a5a004f5 Mon Sep 17 00:00:00 2001
From: chewitt <github@chrishewitt.net>
Date: Mon, 29 Apr 2019 03:23:38 +0000
Subject: [PATCH 28/37] media: rc: add keymap for Khadas VIM/EDGE remote
This is a simple NEC remote control device shipped with the Khadas VIM
and EDGE range of ARM Single Board Computer (SBC) devices. It includes
a mouse button for Android use which is mapped to KEY_MUTE. This is the
sole difference from the Khadas 'geekbox' remote which shipped with an
earlier generation of Shenzen Wesion (Khadas) devices under the GeekBox
brand.
Signed-off-by: Christian Hewitt <christianshewitt@gmail.com>
---
drivers/media/rc/keymaps/Makefile | 2 +
drivers/media/rc/keymaps/rc-khadas.c | 56 ++++++++++++++++++++++++++++
include/media/rc-map.h | 2 +
3 files changed, 60 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 03fbac32befb..7cd930b43e9b 100644
--- a/drivers/media/rc/keymaps/Makefile
+++ b/drivers/media/rc/keymaps/Makefile
@@ -58,6 +58,8 @@ 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-khamsin.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..bb183ed90d69
--- /dev/null
+++ b/drivers/media/rc/keymaps/rc-khadas.c
@@ -0,0 +1,56 @@
+// SPDX-License-Identifier: GPL-2.0+
+//
+// Copyright (C) 2019 Christian Hewitt <christianshewitt@gmail.com>
+
+/*
+ * Keytable for the Khadas (VIM/EDGE) remote controller
+ */
+
+#include <media/rc-map.h>
+#include <linux/module.h>
+
+static struct rc_map_table khadas[] = {
+
+ { 0x14, KEY_POWER },
+
+ { 0x03, KEY_UP },
+ { 0x02, KEY_DOWN },
+ { 0x0e, KEY_LEFT },
+ { 0x1a, KEY_RIGHT },
+ { 0x07, KEY_OK },
+
+ { 0x01, KEY_BACK },
+ { 0x5b, KEY_MUTE }, // mouse
+ { 0x13, KEY_MENU },
+
+ { 0x58, KEY_VOLUMEDOWN },
+ { 0x0b, KEY_VOLUMEUP },
+
+ { 0x48, KEY_HOME },
+
+};
+
+static struct rc_map_list khadas_map = {
+ .map = {
+ .scan = khadas,
+ .size = ARRAY_SIZE(khadas),
+ .rc_proto = RC_PROTO_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("Christian Hewitt <christianshewitt@gmail.com>");
diff --git a/include/media/rc-map.h b/include/media/rc-map.h
index 771e9e2cca50..2e4b83be000c 100644
--- a/include/media/rc-map.h
+++ b/include/media/rc-map.h
@@ -226,6 +226,8 @@ struct rc_map *rc_map_get(const char *name);
#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_KHAMSIN "rc-khamsin"
#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"
--
2.17.1

View File

@ -0,0 +1,100 @@
From 63247dd85895163effd5cffeab10a9e080aa38d6 Mon Sep 17 00:00:00 2001
From: chewitt <github@chrishewitt.net>
Date: Fri, 12 Apr 2019 12:26:30 +0000
Subject: [PATCH 29/37] media: rc: add keymap for KHAMSIN remote
Add an IR keymap for the KHAMSIN IR/BT remote supplied with the SmartLabs
SML-5442TW set-top box. The IR keymap allows basic GUI navigation to pair
the more functional BT mode of the remote.
Signed-off-by: Christian Hewitt <christianshewitt@gmail.com>
---
drivers/media/rc/keymaps/rc-khamsin.c | 76 +++++++++++++++++++++++++++
1 file changed, 76 insertions(+)
create mode 100644 drivers/media/rc/keymaps/rc-khamsin.c
diff --git a/drivers/media/rc/keymaps/rc-khamsin.c b/drivers/media/rc/keymaps/rc-khamsin.c
new file mode 100644
index 000000000000..c5c031f54414
--- /dev/null
+++ b/drivers/media/rc/keymaps/rc-khamsin.c
@@ -0,0 +1,76 @@
+// SPDX-License-Identifier: GPL-2.0+
+// Copyright (c) 2019 Christian Hewitt
+
+#include <media/rc-map.h>
+#include <linux/module.h>
+
+/*
+ * KHAMSIN is an IR/Bluetooth RCU supplied with the SmartLabs
+ * SML-5442TW DVB-S/VOD box. The RCU has separate IR (TV) and
+ * BT (STB) modes. This keymap adds IR controls so that users
+ * can navigate and initiate BT pairing.
+ */
+
+static struct rc_map_table khamsin[] = {
+ { 0x70702, KEY_POWER},
+
+ { 0x70701, KEY_VIDEO}, // source
+
+ { 0x7076c, KEY_RED},
+ { 0x70714, KEY_GREEN},
+ { 0x70715, KEY_YELLOW},
+ { 0x70716, KEY_BLUE},
+
+ { 0x7071a, KEY_MENU},
+ { 0x7074f, KEY_EPG},
+
+ { 0x70760, KEY_UP },
+ { 0x70761, KEY_DOWN },
+ { 0x70765, KEY_LEFT },
+ { 0x70762, KEY_RIGHT },
+ { 0x70768, KEY_ENTER },
+
+ { 0x7072d, KEY_ESC }, // back
+
+ { 0x70707, KEY_VOLUMEUP },
+ { 0x7070b, KEY_VOLUMEDOWN },
+ { 0x7070f, KEY_MUTE },
+ { 0x70712, KEY_CHANNELUP },
+ { 0x70710, KEY_CHANNELDOWN },
+
+ { 0x70704, KEY_1 },
+ { 0x70705, KEY_2 },
+ { 0x70706, KEY_3 },
+ { 0x70708, KEY_4 },
+ { 0x70709, KEY_5 },
+ { 0x7070a, KEY_6 },
+ { 0x7070c, KEY_7 },
+ { 0x7070d, KEY_8 },
+ { 0x7070e, KEY_9 },
+ { 0x70711, KEY_0 },
+};
+
+static struct rc_map_list khamsin_map = {
+ .map = {
+ .scan = khamsin,
+ .size = ARRAY_SIZE(khamsin),
+ .rc_proto = RC_PROTO_NEC,
+ .name = RC_MAP_KHAMSIN,
+ }
+};
+
+static int __init init_rc_map_khamsin(void)
+{
+ return rc_map_register(&khamsin_map);
+}
+
+static void __exit exit_rc_map_khamsin(void)
+{
+ rc_map_unregister(&khamsin_map);
+}
+
+module_init(init_rc_map_khamsin)
+module_exit(exit_rc_map_khamsin)
+
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Christian Hewitt <christianshewitt@gmail.com>");
--
2.17.1

View File

@ -0,0 +1,141 @@
From 252bc63a831762e232d708d32207e866ec8a2193 Mon Sep 17 00:00:00 2001
From: chewitt <github@chrishewitt.net>
Date: Fri, 12 Apr 2019 12:32:11 +0000
Subject: [PATCH 30/37] media: rc: add keymap for Philips RC242 remote
Add an IR keymap for the Philips RC242 remote used with some IPTV/VOD STB's.
Signed-off-by: Christian Hewitt <christianshewitt@gmail.com>
---
drivers/media/rc/keymaps/Makefile | 1 +
drivers/media/rc/keymaps/rc-philips-rc242.c | 93 +++++++++++++++++++++
include/media/rc-map.h | 1 +
3 files changed, 95 insertions(+)
create mode 100644 drivers/media/rc/keymaps/rc-philips-rc242.c
diff --git a/drivers/media/rc/keymaps/Makefile b/drivers/media/rc/keymaps/Makefile
index 7cd930b43e9b..b29353476d0d 100644
--- a/drivers/media/rc/keymaps/Makefile
+++ b/drivers/media/rc/keymaps/Makefile
@@ -79,6 +79,7 @@ obj-$(CONFIG_RC_MAP) += rc-adstech-dvb-t-pci.o \
rc-npgtech.o \
rc-odroid.o \
rc-pctv-sedna.o \
+ rc-philips-rc242.o \
rc-pinnacle-color.o \
rc-pinnacle-grey.o \
rc-pinnacle-pctv-hd.o \
diff --git a/drivers/media/rc/keymaps/rc-philips-rc242.c b/drivers/media/rc/keymaps/rc-philips-rc242.c
new file mode 100644
index 000000000000..7821eb122419
--- /dev/null
+++ b/drivers/media/rc/keymaps/rc-philips-rc242.c
@@ -0,0 +1,93 @@
+// SPDX-License-Identifier: GPL-2.0+
+// Copyright (c) 2019 Christian Hewitt
+
+#include <media/rc-map.h>
+#include <linux/module.h>
+
+/*
+ * The Philips RC242 remote ships is used with the IPTV/VOD STB
+ * from O2 Czech Republic.
+ */
+
+static struct rc_map_table philips_rc242[] = {
+
+ { 0x40c, KEY_POWER },
+ { 0x44a, KEY_INFO },
+ { 0x461, KEY_FAVORITES },
+
+ { 0x401, KEY_1 },
+ { 0x402, KEY_2 },
+ { 0x403, KEY_3 },
+
+ { 0x404, KEY_4 },
+ { 0x405, KEY_5 },
+ { 0x406, KEY_6 },
+
+ { 0x407, KEY_7 },
+ { 0x408, KEY_8 },
+ { 0x409, KEY_9 },
+
+ { 0x448, KEY_ZOOM },
+ { 0x400, KEY_0 },
+ { 0x441, KEY_EPG },
+
+ { 0x412, KEY_CONTEXT_MENU },
+ { 0x437, KEY_RECORD },
+ { 0x430, KEY_PAUSE },
+ { 0x41d, KEY_ZOOM },
+
+ { 0x410, KEY_UP },
+ { 0x411, KEY_DOWN },
+ { 0x415, KEY_LEFT },
+ { 0x416, KEY_RIGHT },
+ { 0x424, KEY_OK },
+
+ { 0x414, KEY_VOLUMEUP },
+ { 0x41f, KEY_BACK },
+ { 0x40e, KEY_CHANNELUP },
+
+ { 0x417, KEY_VOLUMEDOWN },
+ { 0x40d, KEY_MUTE },
+ { 0x40a, KEY_CHANNELDOWN },
+
+ { 0x432, KEY_REWIND },
+ { 0x435, KEY_PLAYPAUSE },
+ { 0x436, KEY_STOP },
+ { 0x434, KEY_FORWARD },
+
+ { 0x451, KEY_PREVIOUSSONG },
+ { 0x43c, KEY_SUBTITLE },
+ { 0x40f, KEY_LANGUAGE },
+ { 0x450, KEY_NEXTSONG },
+
+ { 0x46b, KEY_RED },
+ { 0x46c, KEY_GREEN },
+ { 0x46d, KEY_YELLOW },
+ { 0x46e, KEY_BLUE },
+
+};
+
+static struct rc_map_list philips_rc242_map = {
+ .map = {
+ .scan = philips_rc242,
+ .size = ARRAY_SIZE(philips_rc242),
+ .rc_proto = RC_PROTO_RC5,
+ .name = RC_MAP_PHILIPS_RC242,
+ }
+};
+
+static int __init init_rc_map_philips_rc242(void)
+{
+ return rc_map_register(&philips_rc242_map);
+}
+
+static void __exit exit_rc_map_philips_rc242(void)
+{
+ rc_map_unregister(&philips_rc242_map);
+}
+
+module_init(init_rc_map_philips_rc242)
+module_exit(exit_rc_map_philips_rc242)
+
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Christian Hewitt <christianshewitt@gmail.com>");
diff --git a/include/media/rc-map.h b/include/media/rc-map.h
index 2e4b83be000c..bd7738bf197f 100644
--- a/include/media/rc-map.h
+++ b/include/media/rc-map.h
@@ -247,6 +247,7 @@ struct rc_map *rc_map_get(const char *name);
#define RC_MAP_NPGTECH "rc-npgtech"
#define RC_MAP_ODROID "rc-odroid"
#define RC_MAP_PCTV_SEDNA "rc-pctv-sedna"
+#define RC_MAP_PHILIPS_RC242 "rc-philips-rc242"
#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"
--
2.17.1

View File

@ -0,0 +1,128 @@
From 68be11762925f08a53f2e0ea4064550540d3d7e6 Mon Sep 17 00:00:00 2001
From: chewitt <github@chrishewitt.net>
Date: Mon, 15 Apr 2019 02:44:48 +0000
Subject: [PATCH 31/37] media: rc: add keymap for Tanix TX3 mini remote
This is a simple NEC remote control device shipped with the Tanix TX3
Android STB device.
Signed-off-by: Christian Hewitt <christianshewitt@gmail.com>
---
drivers/media/rc/keymaps/Makefile | 1 +
drivers/media/rc/keymaps/rc-tanix-tx3mini.c | 79 +++++++++++++++++++++
include/media/rc-map.h | 1 +
3 files changed, 81 insertions(+)
create mode 100644 drivers/media/rc/keymaps/rc-tanix-tx3mini.c
diff --git a/drivers/media/rc/keymaps/Makefile b/drivers/media/rc/keymaps/Makefile
index b29353476d0d..23382bbfb3da 100644
--- a/drivers/media/rc/keymaps/Makefile
+++ b/drivers/media/rc/keymaps/Makefile
@@ -98,6 +98,7 @@ obj-$(CONFIG_RC_MAP) += rc-adstech-dvb-t-pci.o \
rc-snapstream-firefly.o \
rc-streamzap.o \
rc-tango.o \
+ rc-tanix-tx3mini.o \
rc-tbs-nec.o \
rc-technisat-ts35.o \
rc-technisat-usb2.o \
diff --git a/drivers/media/rc/keymaps/rc-tanix-tx3mini.c b/drivers/media/rc/keymaps/rc-tanix-tx3mini.c
new file mode 100644
index 000000000000..e5013981fdc4
--- /dev/null
+++ b/drivers/media/rc/keymaps/rc-tanix-tx3mini.c
@@ -0,0 +1,79 @@
+// SPDX-License-Identifier: GPL-2.0+
+// Copyright (c) 2018 Christian Hewitt
+
+#include <media/rc-map.h>
+#include <linux/module.h>
+
+/*
+ * This keymap is used with the Oranth Tanix TX3 mini
+ * and other Android STB devices.
+ */
+
+static struct rc_map_table tanix_tx3mini[] = {
+
+ { 0x8051, KEY_POWER },
+ { 0x804d, KEY_MUTE },
+
+ { 0x8009, KEY_RED },
+ { 0x8011, KEY_GREEN },
+ { 0x8054, KEY_YELLOW },
+ { 0x804f, KEY_BLUE },
+
+ { 0x8056, KEY_VOLUMEDOWN },
+ { 0x80bd, KEY_PREVIOUS },
+ { 0x80bb, KEY_NEXT },
+ { 0x804e, KEY_VOLUMEUP },
+
+ { 0x8053, KEY_HOME },
+ { 0x801b, KEY_BACK },
+
+ { 0x8026, KEY_UP },
+ { 0x8028, KEY_DOWN },
+ { 0x8025, KEY_LEFT },
+ { 0x8027, KEY_RIGHT },
+ { 0x800d, KEY_OK },
+
+ { 0x8049, KEY_MENU },
+ { 0x8052, KEY_EPG }, // mouse
+
+ { 0x8031, KEY_1 },
+ { 0x8032, KEY_2 },
+ { 0x8033, KEY_3 },
+
+ { 0x8034, KEY_4 },
+ { 0x8035, KEY_5 },
+ { 0x8036, KEY_6 },
+
+ { 0x8037, KEY_7 },
+ { 0x8038, KEY_8 },
+ { 0x8039, KEY_9 },
+
+ { 0x8058, KEY_SUBTITLE }, // 1/a
+ { 0x8030, KEY_0 },
+ { 0x8044, KEY_DELETE },
+};
+
+static struct rc_map_list tanix_tx3mini_map = {
+ .map = {
+ .scan = tanix_tx3mini,
+ .size = ARRAY_SIZE(tanix_tx3mini),
+ .rc_proto = RC_PROTO_NEC,
+ .name = RC_MAP_TANIX_TX3MINI,
+ }
+};
+
+static int __init init_rc_map_tanix_tx3mini(void)
+{
+ return rc_map_register(&tanix_tx3mini_map);
+}
+
+static void __exit exit_rc_map_tanix_tx3mini(void)
+{
+ rc_map_unregister(&tanix_tx3mini_map);
+}
+
+module_init(init_rc_map_tanix_tx3mini)
+module_exit(exit_rc_map_tanix_tx3mini)
+
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Christian Hewitt <christianshewitt@gmail.com>");
diff --git a/include/media/rc-map.h b/include/media/rc-map.h
index bd7738bf197f..30513f5d764a 100644
--- a/include/media/rc-map.h
+++ b/include/media/rc-map.h
@@ -267,6 +267,7 @@ struct rc_map *rc_map_get(const char *name);
#define RC_MAP_SNAPSTREAM_FIREFLY "rc-snapstream-firefly"
#define RC_MAP_STREAMZAP "rc-streamzap"
#define RC_MAP_TANGO "rc-tango"
+#define RC_MAP_TANIX_TX3MINI "rc-tanix-tx3mini"
#define RC_MAP_TBS_NEC "rc-tbs-nec"
#define RC_MAP_TECHNISAT_TS35 "rc-technisat-ts35"
#define RC_MAP_TECHNISAT_USB2 "rc-technisat-usb2"
--
2.17.1

View File

@ -0,0 +1,104 @@
From cb88289d080823bb33f162d05304724190b88763 Mon Sep 17 00:00:00 2001
From: chewitt <github@chrishewitt.net>
Date: Mon, 15 Apr 2019 04:37:44 +0000
Subject: [PATCH 32/37] media: rc: add keymap for WeTek Hub remote
This is a simple RC5 remote control device shipped with the WeTek Hub
Android STB device.
Signed-off-by: Christian Hewitt <christianshewitt@gmail.com>
---
drivers/media/rc/keymaps/Makefile | 1 +
drivers/media/rc/keymaps/rc-wetek-hub.c | 55 +++++++++++++++++++++++++
include/media/rc-map.h | 1 +
3 files changed, 57 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 23382bbfb3da..32f93942c3b2 100644
--- a/drivers/media/rc/keymaps/Makefile
+++ b/drivers/media/rc/keymaps/Makefile
@@ -118,6 +118,7 @@ obj-$(CONFIG_RC_MAP) += rc-adstech-dvb-t-pci.o \
rc-videomate-m1f.o \
rc-videomate-s350.o \
rc-videomate-tv-pvr.o \
+ rc-wetek-hub.o \
rc-winfast.o \
rc-winfast-usbii-deluxe.o \
rc-su3000.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..8d114ae59669
--- /dev/null
+++ b/drivers/media/rc/keymaps/rc-wetek-hub.c
@@ -0,0 +1,55 @@
+// SPDX-License-Identifier: GPL-2.0+
+// Copyright (c) 2018 Christian Hewitt
+
+#include <media/rc-map.h>
+#include <linux/module.h>
+
+/*
+ * This keymap is used with the WeTek Hub STB.
+ */
+
+static struct rc_map_table wetek_hub[] = {
+
+ { 0x77f1, KEY_POWER },
+
+ { 0x77f2, KEY_HOME },
+ { 0x77f3, KEY_MUTE }, // mouse
+
+ { 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_proto = RC_PROTO_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("Christian Hewitt <christianshewitt@gmail.com>");
diff --git a/include/media/rc-map.h b/include/media/rc-map.h
index 30513f5d764a..034bd38dffe7 100644
--- a/include/media/rc-map.h
+++ b/include/media/rc-map.h
@@ -287,6 +287,7 @@ struct rc_map *rc_map_get(const char *name);
#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"
+#define RC_MAP_WETEK_HUB "rc-wetek-hub"
#define RC_MAP_WINFAST "rc-winfast"
#define RC_MAP_WINFAST_USBII_DELUXE "rc-winfast-usbii-deluxe"
#define RC_MAP_SU3000 "rc-su3000"
--
2.17.1

View File

@ -0,0 +1,141 @@
From 316e5b987b9e72138eb2270d5f3c41118b61152b Mon Sep 17 00:00:00 2001
From: chewitt <github@chrishewitt.net>
Date: Sun, 21 Apr 2019 02:24:07 +0000
Subject: [PATCH 33/37] media: rc: add keymap for WeTeK Play 2 remote
Signed-off-by: Christian Hewitt <christianshewitt@gmail.com>
---
drivers/media/rc/keymaps/Makefile | 1 +
drivers/media/rc/keymaps/rc-wetek-play2.c | 95 +++++++++++++++++++++++
include/media/rc-map.h | 1 +
3 files changed, 97 insertions(+)
create mode 100644 drivers/media/rc/keymaps/rc-wetek-play2.c
diff --git a/drivers/media/rc/keymaps/Makefile b/drivers/media/rc/keymaps/Makefile
index 32f93942c3b2..b2c13dac1755 100644
--- a/drivers/media/rc/keymaps/Makefile
+++ b/drivers/media/rc/keymaps/Makefile
@@ -119,6 +119,7 @@ obj-$(CONFIG_RC_MAP) += rc-adstech-dvb-t-pci.o \
rc-videomate-s350.o \
rc-videomate-tv-pvr.o \
rc-wetek-hub.o \
+ rc-wetek-play2.o \
rc-winfast.o \
rc-winfast-usbii-deluxe.o \
rc-su3000.o \
diff --git a/drivers/media/rc/keymaps/rc-wetek-play2.c b/drivers/media/rc/keymaps/rc-wetek-play2.c
new file mode 100644
index 000000000000..77504f207578
--- /dev/null
+++ b/drivers/media/rc/keymaps/rc-wetek-play2.c
@@ -0,0 +1,95 @@
+// SPDX-License-Identifier: GPL-2.0+
+//
+// Copyright (C) 2019 Christian Hewitt <christianshewitt@gmail.com>
+
+#include <media/rc-map.h>
+#include <linux/module.h>
+
+//
+// Keytable for the WeTek Play 2 remote controller
+//
+
+static struct rc_map_table wetek_play2[] = {
+
+ { 0x5e5f02, KEY_POWER },
+ { 0x5e5f46, KEY_SLEEP }, // tv
+ { 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_BACK },
+ { 0x5e5f21, KEY_0 },
+ { 0x5e5f72, KEY_CAPSLOCK },
+
+ // outer ring clockwide from top
+ { 0x5e5f03, KEY_HOME },
+ { 0x5e5f61, KEY_BACK },
+ { 0x5e5f77, KEY_CONFIG }, // mouse
+ { 0x5e5f83, KEY_EPG },
+ { 0x5e5f84, KEY_SCREEN }, // square
+ { 0x5e5f48, KEY_MENU },
+
+ // inner ring
+ { 0x5e5f50, KEY_UP },
+ { 0x5e5f4b, KEY_DOWN },
+ { 0x5e5f4c, KEY_LEFT },
+ { 0x5e5f4d, KEY_RIGHT },
+ { 0x5e5f47, KEY_OK },
+
+ { 0x5e5f44, KEY_VOLUMEUP },
+ { 0x5e5f43, KEY_VOLUMEDOWN },
+ { 0x5e5f4f, KEY_FAVORITES },
+ { 0x5e5f82, KEY_SUBTITLE }, // txt
+ { 0x5e5f41, KEY_PAGEUP },
+ { 0x5e5f42, KEY_PAGEDOWN },
+
+ { 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 },
+
+};
+
+static struct rc_map_list wetek_play2_map = {
+ .map = {
+ .scan = wetek_play2,
+ .size = ARRAY_SIZE(wetek_play2),
+ .rc_proto = RC_PROTO_NEC,
+ .name = RC_MAP_WETEK_PLAY2,
+ }
+};
+
+static int __init init_rc_map_wetek_play2(void)
+{
+ return rc_map_register(&wetek_play2_map);
+}
+
+static void __exit exit_rc_map_wetek_play2(void)
+{
+ rc_map_unregister(&wetek_play2_map);
+}
+
+module_init(init_rc_map_wetek_play2)
+module_exit(exit_rc_map_wetek_play2)
+
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Christian Hewitt <christianshewitt@gmail.com");
diff --git a/include/media/rc-map.h b/include/media/rc-map.h
index 034bd38dffe7..49fe4e73b28b 100644
--- a/include/media/rc-map.h
+++ b/include/media/rc-map.h
@@ -288,6 +288,7 @@ struct rc_map *rc_map_get(const char *name);
#define RC_MAP_VIDEOMATE_S350 "rc-videomate-s350"
#define RC_MAP_VIDEOMATE_TV_PVR "rc-videomate-tv-pvr"
#define RC_MAP_WETEK_HUB "rc-wetek-hub"
+#define RC_MAP_WETEK_PLAY2 "rc-wetek-play2"
#define RC_MAP_WINFAST "rc-winfast"
#define RC_MAP_WINFAST_USBII_DELUXE "rc-winfast-usbii-deluxe"
#define RC_MAP_SU3000 "rc-su3000"
--
2.17.1

View File

@ -0,0 +1,35 @@
From b6595329084bcfdb5ac3192b8abd5ccf1a1e5531 Mon Sep 17 00:00:00 2001
From: chewitt <github@chrishewitt.net>
Date: Sun, 14 Apr 2019 03:25:54 +0000
Subject: [PATCH 34/37] ASoC: meson: correct i2s error messages
Reorder words so they read correctly.
Signed-off-by: Christian Hewitt <christianshewitt@gmail.com>
---
sound/soc/meson-gx/aiu-i2s.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/soc/meson-gx/aiu-i2s.c b/sound/soc/meson-gx/aiu-i2s.c
index c6bfd5d8c808..3d1937946db0 100644
--- a/sound/soc/meson-gx/aiu-i2s.c
+++ b/sound/soc/meson-gx/aiu-i2s.c
@@ -500,13 +500,13 @@ static int meson_aiu_i2s_dai_hw_params(struct snd_pcm_substream *substream,
ret = __setup_desc(priv, width, channels);
if (ret) {
- dev_err(dai->dev, "Unable set to set i2s description\n");
+ dev_err(dai->dev, "Unable to set i2s description\n");
return ret;
}
ret = __bclks_set_rate(priv, rate, width);
if (ret) {
- dev_err(dai->dev, "Unable set to the i2s clock rates\n");
+ dev_err(dai->dev, "Unable to set i2s clock rates\n");
return ret;
}
--
2.17.1

View File

@ -0,0 +1,28 @@
From 301268ffe271846dbd8aad357ac1cc727d5d2259 Mon Sep 17 00:00:00 2001
From: chewitt <github@chrishewitt.net>
Date: Wed, 24 Apr 2019 10:49:48 +0000
Subject: [PATCH 35/37] dt-bindings: Add vendor prefix for SmartLabs LLC.
SmartLabs LLC. are an integrator of Interactive TV solutions and IPTV/STB
devices (https://www.smartlabs.tv/en/about/) for Telco/ISP customers.
Signed-off-by: Christian Hewitt <christianshewitt@gmail.com>
---
Documentation/devicetree/bindings/vendor-prefixes.txt | 1 +
1 file changed, 1 insertion(+)
diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt b/Documentation/devicetree/bindings/vendor-prefixes.txt
index 8162b0eb4b50..1de094caec5c 100644
--- a/Documentation/devicetree/bindings/vendor-prefixes.txt
+++ b/Documentation/devicetree/bindings/vendor-prefixes.txt
@@ -374,6 +374,7 @@ sirf SiRF Technology, Inc.
sis Silicon Integrated Systems Corp.
sitronix Sitronix Technology Corporation
skyworks Skyworks Solutions, Inc.
+smartlabs SmartLabs LLC.
smsc Standard Microsystems Corporation
snps Synopsys, Inc.
socionext Socionext Inc.
--
2.17.1

View File

@ -0,0 +1,44 @@
From 30ae92c1678dcab79407fd2a03635d11141e666c Mon Sep 17 00:00:00 2001
From: chewitt <github@chrishewitt.net>
Date: Wed, 24 Apr 2019 10:52:06 +0000
Subject: [PATCH 36/37] dt-bindings: arm: amlogic: Add support for the
SmartLabs SML-5442TW
The SmartLabs SML-5442TW is the next-gen/4K IPTV/DVB-S STB for O2 Czech based
on the Amlogic P231 reference design using the S905D chipset with widevine L1
license. Hardware specification:
- 2GB DDR3 RAM
- 8GB eMMC storage
- 10/100 Base-T Ethernet
- 802.11 a/b/g/n/ac + BT 4.1 HS sdio wireless module (QCA9377)
- 2x single colour and 1x dual colour LEDs on the front panel
- 1x reset button on the front panel
- HDMI 2.0 (4k@60p) video
- Composite video + 2-channel audio output on 3.5mm jack
- S/PDIF audio output
- Single DVB-S tuner (AVL6762/MxL608)
- 2x USB 2.0 ports
- 1x micro SD card slot
- UART pins (internal)
Signed-off-by: Christian Hewitt <christianshewitt@gmail.com>
---
Documentation/devicetree/bindings/arm/amlogic.txt | 1 +
1 file changed, 1 insertion(+)
diff --git a/Documentation/devicetree/bindings/arm/amlogic.txt b/Documentation/devicetree/bindings/arm/amlogic.txt
index 7f40cb5f490b..2e706c6dd175 100644
--- a/Documentation/devicetree/bindings/arm/amlogic.txt
+++ b/Documentation/devicetree/bindings/arm/amlogic.txt
@@ -92,6 +92,7 @@ Board compatible values (alphabetically, grouped by SoC):
- "amlogic,p230" (Meson gxl s905d)
- "amlogic,p231" (Meson gxl s905d)
- "phicomm,n1" (Meson gxl s905d)
+ - "smartlabs,sml5442tw" (Meson gxl s905d)
- "amlogic,p241" (Meson gxl s805x)
- "libretech,aml-s805x-ac" (Meson gxl s805x)
--
2.17.1

View File

@ -0,0 +1,334 @@
From eec12dffbedb498597b8eb3b7f6fad76cd24d0d7 Mon Sep 17 00:00:00 2001
From: chewitt <github@chrishewitt.net>
Date: Wed, 24 Apr 2019 10:56:33 +0000
Subject: [PATCH 37/37] ARM64: dts: meson-gxl: Add support for the SmartLabs
SML-5442TW
The SmartLabs SML-5442TW is broadly similar to the P231 reference design
but with the following differences:
- Yellow and Blue front-panel LEDs are available but disabled
- Red/Green LED is used to signal off/on status
- GPIOX_17 is set high to enable the QCA9377 wireless module
- uart_AO can be accessed after opening the case; soldered pins exist
Signed-off-by: Christian Hewitt <christianshewitt@gmail.com>
---
arch/arm64/boot/dts/amlogic/Makefile | 1 +
.../meson-gxl-s905d-smartlabs-sml5442tw.dts | 202 ++++++++++++++++++
drivers/media/rc/keymaps/Makefile | 1 +
drivers/media/rc/keymaps/rc-vega-s95.c | 56 +++++
include/media/rc-map.h | 1 +
5 files changed, 261 insertions(+)
create mode 100644 arch/arm64/boot/dts/amlogic/meson-gxl-s905d-smartlabs-sml5442tw.dts
create mode 100644 drivers/media/rc/keymaps/rc-vega-s95.c
diff --git a/arch/arm64/boot/dts/amlogic/Makefile b/arch/arm64/boot/dts/amlogic/Makefile
index 0821fed4c074..8a948b6b4f5d 100644
--- a/arch/arm64/boot/dts/amlogic/Makefile
+++ b/arch/arm64/boot/dts/amlogic/Makefile
@@ -21,6 +21,7 @@ dtb-$(CONFIG_ARCH_MESON) += meson-gxl-s905x-p212.dtb
dtb-$(CONFIG_ARCH_MESON) += meson-gxl-s905d-p230.dtb
dtb-$(CONFIG_ARCH_MESON) += meson-gxl-s905d-p231.dtb
dtb-$(CONFIG_ARCH_MESON) += meson-gxl-s905d-phicomm-n1.dtb
+dtb-$(CONFIG_ARCH_MESON) += meson-gxl-s905d-smartlabs-sml5442tw.dtb
dtb-$(CONFIG_ARCH_MESON) += meson-gxl-s805x-p241.dtb
dtb-$(CONFIG_ARCH_MESON) += meson-gxl-s905w-p281.dtb
dtb-$(CONFIG_ARCH_MESON) += meson-gxl-s905w-tx3-mini.dtb
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxl-s905d-smartlabs-sml5442tw.dts b/arch/arm64/boot/dts/amlogic/meson-gxl-s905d-smartlabs-sml5442tw.dts
new file mode 100644
index 000000000000..a574fdc17dd3
--- /dev/null
+++ b/arch/arm64/boot/dts/amlogic/meson-gxl-s905d-smartlabs-sml5442tw.dts
@@ -0,0 +1,202 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) Christian Hewitt <christianshewitt@gmail.com>
+ */
+
+/dts-v1/;
+
+#include "meson-gxl-s905d-p231.dts"
+
+/ {
+ compatible = "smartlabs,sml5442tw", "amlogic,s905d", "amlogic,meson-gxl";
+ model = "SmartLabs SML-5442TW for O2.cz";
+
+ aliases {
+ serial1 = &uart_A;
+ };
+
+ leds {
+ compatible = "gpio-leds";
+
+ yellow {
+ label = "sml5442tw:yellow";
+ gpios = <&gpio_ao GPIOAO_6 GPIO_ACTIVE_HIGH>;
+ default-state = "off";
+ };
+
+ blue {
+ label = "sml5442tw:blue";
+ gpios = <&gpio GPIODV_28 GPIO_ACTIVE_HIGH>;
+ default-state = "off";
+ };
+
+ green {
+ label = "sml5442tw:green";
+ gpios = <&gpio_ao GPIOAO_9 GPIO_ACTIVE_HIGH>;
+ default-state = "on";
+ };
+
+ red {
+ label = "sml5442tw:red";
+ gpios = <&gpio GPIODV_27 GPIO_ACTIVE_HIGH>;
+ default-state = "off";
+ };
+ };
+};
+
+&cec_AO {
+ status = "okay";
+ pinctrl-0 = <&ao_cec_pins>;
+ pinctrl-names = "default";
+ hdmi-phandle = <&hdmi_tx>;
+};
+
+&audio {
+ status = "okay";
+};
+
+&aiu_i2s {
+ status = "okay";
+};
+
+&cvbs_vdac_port {
+ cvbs_vdac_out: endpoint {
+ remote-endpoint = <&cvbs_connector_in>;
+ };
+};
+
+&ethmac {
+ status = "okay";
+ phy-mode = "rmii";
+ phy-handle = <&internal_phy>;
+};
+
+/* This will enable the bluetooth module */
+&gpio {
+ bt-en {
+ gpio-hog;
+ gpios = <GPIOX_17 GPIO_ACTIVE_HIGH>;
+ output-high;
+ line-name = "bt-en";
+ };
+};
+
+&hdmi_tx {
+ status = "okay";
+ pinctrl-0 = <&hdmi_hpd_pins>, <&hdmi_i2c_pins>;
+ pinctrl-names = "default";
+};
+
+&hdmi_tx_tmds_port {
+ hdmi_tx_tmds_out: endpoint {
+ remote-endpoint = <&hdmi_connector_in>;
+ };
+};
+
+&i2c_A {
+ status = "okay";
+ pinctrl-0 = <&i2c_a_pins>;
+ pinctrl-names = "default";
+};
+
+&internal_phy {
+ pinctrl-0 = <&eth_link_led_pins>, <&eth_act_led_pins>;
+ pinctrl-names = "default";
+};
+
+&ir {
+ status = "okay";
+ pinctrl-0 = <&remote_input_ao_pins>;
+ pinctrl-names = "default";
+ linux,rc-map-name = "rc-khamsin";
+};
+
+&pwm_ef {
+ status = "okay";
+ pinctrl-0 = <&pwm_e_pins>;
+ pinctrl-names = "default";
+ clocks = <&clkc CLKID_FCLK_DIV4>;
+ clock-names = "clkin0";
+};
+
+&saradc {
+ status = "okay";
+ vref-supply = <&vddio_ao18>;
+};
+
+/* Wireless SDIO Module */
+&sd_emmc_a {
+ status = "okay";
+ pinctrl-0 = <&sdio_pins>;
+ pinctrl-1 = <&sdio_clk_gate_pins>;
+ pinctrl-names = "default", "clk-gate";
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ bus-width = <4>;
+ cap-sd-highspeed;
+ max-frequency = <100000000>;
+
+ non-removable;
+ disable-wp;
+
+ mmc-pwrseq = <&sdio_pwrseq>;
+
+ vmmc-supply = <&vddao_3v3>;
+ vqmmc-supply = <&vddio_boot>;
+};
+
+/* SD card */
+&sd_emmc_b {
+ status = "okay";
+ pinctrl-0 = <&sdcard_pins>;
+ pinctrl-1 = <&sdcard_clk_gate_pins>;
+ pinctrl-names = "default", "clk-gate";
+
+ bus-width = <4>;
+ cap-sd-highspeed;
+ max-frequency = <100000000>;
+ disable-wp;
+
+ cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_LOW>;
+
+ vmmc-supply = <&vddao_3v3>;
+ vqmmc-supply = <&vddio_boot>;
+};
+
+/* eMMC */
+&sd_emmc_c {
+ status = "okay";
+ pinctrl-0 = <&emmc_pins>, <&emmc_ds_pins>;
+ pinctrl-1 = <&emmc_clk_gate_pins>;
+ pinctrl-names = "default", "clk-gate";
+
+ bus-width = <8>;
+ cap-mmc-highspeed;
+ max-frequency = <200000000>;
+ non-removable;
+ disable-wp;
+ mmc-ddr-1_8v;
+ mmc-hs200-1_8v;
+
+ mmc-pwrseq = <&emmc_pwrseq>;
+ vmmc-supply = <&vcc_3v3>;
+ vqmmc-supply = <&vddio_boot>;
+};
+
+/* This is connected to the Bluetooth module: */
+&uart_A {
+ status = "okay";
+ pinctrl-0 = <&uart_a_pins>, <&uart_a_cts_rts_pins>;
+ pinctrl-names = "default";
+};
+
+&uart_AO {
+ status = "okay";
+ pinctrl-0 = <&uart_ao_a_pins>;
+ pinctrl-names = "default";
+};
+
+&usb0 {
+ status = "okay";
+};
diff --git a/drivers/media/rc/keymaps/Makefile b/drivers/media/rc/keymaps/Makefile
index b2c13dac1755..ce4dff101355 100644
--- a/drivers/media/rc/keymaps/Makefile
+++ b/drivers/media/rc/keymaps/Makefile
@@ -118,6 +118,7 @@ obj-$(CONFIG_RC_MAP) += rc-adstech-dvb-t-pci.o \
rc-videomate-m1f.o \
rc-videomate-s350.o \
rc-videomate-tv-pvr.o \
+ rc-vega-s95.o \
rc-wetek-hub.o \
rc-wetek-play2.o \
rc-winfast.o \
diff --git a/drivers/media/rc/keymaps/rc-vega-s95.c b/drivers/media/rc/keymaps/rc-vega-s95.c
new file mode 100644
index 000000000000..533464ecf932
--- /dev/null
+++ b/drivers/media/rc/keymaps/rc-vega-s95.c
@@ -0,0 +1,56 @@
+// SPDX-License-Identifier: GPL-2.0+
+//
+// Copyright (c) 2018 Christian Hewitt <christianshewitt@gmail.com>
+
+#include <media/rc-map.h>
+#include <linux/module.h>
+
+/*
+ * This keymap is used with the Tronsmart Vega S95 Android STB
+ */
+
+static struct rc_map_table vega_s95[] = {
+
+ { 0x18, KEY_POWER },
+ { 0x17, KEY_INFO }, // mouse
+
+ { 0x46, KEY_UP },
+ { 0x16, KEY_DOWN },
+ { 0x47, KEY_LEFT },
+ { 0x15, KEY_RIGHT },
+ { 0x55, KEY_OK },
+
+ { 0x06, KEY_HOME },
+ { 0x42, KEY_PLAYPAUSE},
+ { 0x40, KEY_BACK },
+
+ { 0x14, KEY_VOLUMEDOWN },
+ { 0x04, KEY_MENU },
+ { 0x10, KEY_VOLUMEUP },
+
+};
+
+static struct rc_map_list vega_s95_map = {
+ .map = {
+ .scan = vega_s95,
+ .size = ARRAY_SIZE(vega_s95),
+ .rc_proto = RC_PROTO_NEC,
+ .name = RC_MAP_VEGA_S95,
+ }
+};
+
+static int __init init_rc_map_vega_s95(void)
+{
+ return rc_map_register(&vega_s95_map);
+}
+
+static void __exit exit_rc_map_vega_s95(void)
+{
+ rc_map_unregister(&vega_s95_map);
+}
+
+module_init(init_rc_map_vega_s95)
+module_exit(exit_rc_map_vega_s95)
+
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Christian Hewitt <christianshewitt@gmail.com>");
diff --git a/include/media/rc-map.h b/include/media/rc-map.h
index 49fe4e73b28b..491ef0382575 100644
--- a/include/media/rc-map.h
+++ b/include/media/rc-map.h
@@ -284,6 +284,7 @@ struct rc_map *rc_map_get(const char *name);
#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_VEGA_S95 "rc-vega-s95"
#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"
--
2.17.1

View File

@ -0,0 +1,36 @@
From 20f45db7f0cbe5523f0b6618d533f9e40cb6d051 Mon Sep 17 00:00:00 2001
From: kszaq <kszaquitto@gmail.com>
Date: Mon, 29 Apr 2019 22:42:13 +0200
Subject: [PATCH] ARM64: dts: meson-gx: add ATF BL32 reserved memory region
Vendor firmware/uboot has an additional reserved region
for BL32 trusted firmware. If a board uses BL32 firmware,
booting kernel without knowledge of this region would cause
an immediate kernel panic on SError Interrupt.
TODO: This should be enabled only for boards actually requiring it.
---
arch/arm64/boot/dts/amlogic/meson-gx.dtsi | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/arch/arm64/boot/dts/amlogic/meson-gx.dtsi b/arch/arm64/boot/dts/amlogic/meson-gx.dtsi
index 8238f55..17e8d37 100644
--- a/arch/arm64/boot/dts/amlogic/meson-gx.dtsi
+++ b/arch/arm64/boot/dts/amlogic/meson-gx.dtsi
@@ -41,6 +41,12 @@
no-map;
};
+ /* 32 MiB reserved for ARM Trusted Firmware (BL32) */
+ secmon_reserved_bl32: secmon@5300000 {
+ reg = <0x0 0x05300000 0x0 0x2000000>;
+ no-map;
+ };
+
linux,cma {
compatible = "shared-dma-pool";
reusable;
--
2.7.4

View File

@ -0,0 +1,134 @@
From 87585a9b61475fb44bdba734124ce6071191b201 Mon Sep 17 00:00:00 2001
From: chewitt <github@chrishewitt.net>
Date: Sun, 7 Apr 2019 04:20:56 +0000
Subject: [PATCH 2/6] media: rc: add keymap for Amediatech X96-MAX remote
This is a simple NEC remote control device shipped with the Amediatech
X96 MAX Android 'TV Box' device. The remote contains a programmable TV
controls section with buttons that are not mappable, but are indicated
in the keymap for reference.
Signed-off-by: Christian Hewitt <christianshewitt@gmail.com>
---
drivers/media/rc/keymaps/Makefile | 1 +
drivers/media/rc/keymaps/rc-x96max.c | 85 ++++++++++++++++++++++++++++
include/media/rc-map.h | 1 +
3 files changed, 87 insertions(+)
create mode 100644 drivers/media/rc/keymaps/rc-x96max.c
diff --git a/drivers/media/rc/keymaps/Makefile b/drivers/media/rc/keymaps/Makefile
index 03fbac32befb..f757305eacb2 100644
--- a/drivers/media/rc/keymaps/Makefile
+++ b/drivers/media/rc/keymaps/Makefile
@@ -118,4 +118,5 @@ obj-$(CONFIG_RC_MAP) += rc-adstech-dvb-t-pci.o \
rc-winfast-usbii-deluxe.o \
rc-su3000.o \
rc-xbox-dvd.o \
+ rc-x96max.o \
rc-zx-irdec.o
diff --git a/drivers/media/rc/keymaps/rc-x96max.c b/drivers/media/rc/keymaps/rc-x96max.c
new file mode 100644
index 000000000000..cea5c1c7bf36
--- /dev/null
+++ b/drivers/media/rc/keymaps/rc-x96max.c
@@ -0,0 +1,85 @@
+// SPDX-License-Identifier: GPL-2.0+
+//
+// Copyright (C) 2019 Christian Hewitt <christianshewitt@gmail.com>
+
+#include <media/rc-map.h>
+#include <linux/module.h>
+
+//
+// Keytable for the Amediatecch X96-max remote control
+//
+
+static struct rc_map_table x96max[] = {
+
+ { 0x140, KEY_POWER },
+
+ // ** TV CONTROLS **
+ // SET
+ // AV/TV
+ // POWER
+ // VOLUME UP
+ // VOLUME DOWN
+
+ { 0x118, KEY_VOLUMEUP },
+ { 0x110, KEY_VOLUMEDOWN },
+
+ { 0x143, KEY_CONFIG },
+
+ { 0x100, KEY_INFO }, // MOUSE
+ { 0x119, KEY_BACK },
+
+ { 0x116, KEY_UP },
+ { 0x151, KEY_LEFT },
+ { 0x150, KEY_RIGHT },
+ { 0x11a, KEY_DOWN },
+ { 0x113, KEY_OK },
+
+ { 0x111, KEY_HOME },
+ { 0x14c, KEY_CONTEXT_MENU },
+
+ { 0x159, KEY_PREVIOUS },
+ { 0x15a, KEY_PLAYPAUSE },
+ { 0x158, KEY_NEXT },
+
+ { 0x147, KEY_MENU }, // @ KEY
+ { 0x101, KEY_NUMERIC_0 },
+ { 0x142, KEY_BACKSPACE },
+
+ { 0x14e, KEY_NUMERIC_1 },
+ { 0x10d, KEY_NUMERIC_2 },
+ { 0x10c, KEY_NUMERIC_3 },
+
+ { 0x14a, KEY_NUMERIC_4 },
+ { 0x109, KEY_NUMERIC_5 },
+ { 0x108, KEY_NUMERIC_6 },
+
+ { 0x146, KEY_NUMERIC_7 },
+ { 0x105, KEY_NUMERIC_8 },
+ { 0x104, KEY_NUMERIC_9 },
+
+};
+
+static struct rc_map_list x96max_map = {
+ .map = {
+ .scan = x96max,
+ .size = ARRAY_SIZE(x96max),
+ .rc_proto = RC_PROTO_NEC,
+ .name = RC_MAP_X96MAX,
+ }
+};
+
+static int __init init_rc_map_x96max(void)
+{
+ return rc_map_register(&x96max_map);
+}
+
+static void __exit exit_rc_map_x96max(void)
+{
+ rc_map_unregister(&x96max_map);
+}
+
+module_init(init_rc_map_x96max)
+module_exit(exit_rc_map_x96max)
+
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Christian Hewitt <christianshewitt@gmail.com");
diff --git a/include/media/rc-map.h b/include/media/rc-map.h
index 771e9e2cca50..ac538a5c55d9 100644
--- a/include/media/rc-map.h
+++ b/include/media/rc-map.h
@@ -287,6 +287,7 @@ struct rc_map *rc_map_get(const char *name);
#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_X96MAX "rc-x96max"
#define RC_MAP_ZX_IRDEC "rc-zx-irdec"
/*
--
2.17.1

View File

@ -0,0 +1,25 @@
From 827fdc48e582dad1a78b14ed800de8ddc614ea5b Mon Sep 17 00:00:00 2001
From: chewitt <github@chrishewitt.net>
Date: Sat, 20 Apr 2019 23:51:04 +0000
Subject: [PATCH 3/6] arm64: dts: meson-g12b-odroid-n2: add rc-odroid ir keymap
Signed-off-by: Christian Hewitt <christianshewitt@gmail.com>
---
arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts
index 380b5cebb21d..9ab68ff0cca3 100644
--- a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts
+++ b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts
@@ -228,6 +228,7 @@
status = "okay";
pinctrl-0 = <&remote_input_ao_pins>;
pinctrl-names = "default";
+ linux,rc-map-name = "rc-odroid";
};
/* SD card */
--
2.17.1

View File

@ -0,0 +1,25 @@
From 8337a65c09a0252ac8d25e1c5720cafd8c635252 Mon Sep 17 00:00:00 2001
From: chewitt <github@chrishewitt.net>
Date: Sat, 20 Apr 2019 23:52:15 +0000
Subject: [PATCH 4/6] arm64: dts: meson-g12a-x96-max: add rc-x96max ir keymap
Signed-off-by: Christian Hewitt <christianshewitt@gmail.com>
---
arch/arm64/boot/dts/amlogic/meson-g12a-x96-max.dts | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/arm64/boot/dts/amlogic/meson-g12a-x96-max.dts b/arch/arm64/boot/dts/amlogic/meson-g12a-x96-max.dts
index 648b7deed22d..3ad4db440fbd 100644
--- a/arch/arm64/boot/dts/amlogic/meson-g12a-x96-max.dts
+++ b/arch/arm64/boot/dts/amlogic/meson-g12a-x96-max.dts
@@ -168,6 +168,7 @@
status = "okay";
pinctrl-0 = <&remote_input_ao_pins>;
pinctrl-names = "default";
+ linux,rc-map-name = "rc-x96max";
};
&ext_mdio {
--
2.17.1

View File

@ -0,0 +1,332 @@
From 3dc28e080cbd6da0d9d908266aff6d14c053dbda Mon Sep 17 00:00:00 2001
From: chewitt <github@chrishewitt.net>
Date: Mon, 22 Apr 2019 07:17:31 +0000
Subject: [PATCH 5/6] arm64: dts: add meson-g12a-x96-max-rmii dts
Some variants of the X96 max use the internal rmii PHY instead of external
rgmii PHY so provide a device-tree for them.
Signed-off-by: Christian Hewitt <christianshewitt@gmail.com>
---
.../devicetree/bindings/arm/amlogic.txt | 3 +-
arch/arm64/boot/dts/amlogic/Makefile | 1 +
.../dts/amlogic/meson-g12a-x96-max-rmii.dts | 281 ++++++++++++++++++
3 files changed, 284 insertions(+), 1 deletion(-)
create mode 100644 arch/arm64/boot/dts/amlogic/meson-g12a-x96-max-rmii.dts
diff --git a/Documentation/devicetree/bindings/arm/amlogic.txt b/Documentation/devicetree/bindings/arm/amlogic.txt
index eff41128268e..b78220bb3feb 100644
--- a/Documentation/devicetree/bindings/arm/amlogic.txt
+++ b/Documentation/devicetree/bindings/arm/amlogic.txt
@@ -113,7 +113,8 @@ Board compatible values (alphabetically, grouped by SoC):
- "amlogic,s400" (Meson axg a113d)
- "amlogic,u200" (Meson g12a s905d2)
- - "amediatech,x96-max" (Meson g12a s905x2)
+ - "amediatech,x96-max" (Meson g12a s905x2 using external PHY)
+ - "amediatech,x96-max-rmii" (Meson g12a s905x2 using internal PHY)
- "seirobotics,sei510" (Meson g12a s905x2)
- "hardkernel,odroid-n2" (Meson g12b s922x)
diff --git a/arch/arm64/boot/dts/amlogic/Makefile b/arch/arm64/boot/dts/amlogic/Makefile
index 07b861fe5fa5..3eeda866ced1 100644
--- a/arch/arm64/boot/dts/amlogic/Makefile
+++ b/arch/arm64/boot/dts/amlogic/Makefile
@@ -3,6 +3,7 @@ dtb-$(CONFIG_ARCH_MESON) += meson-axg-s400.dtb
dtb-$(CONFIG_ARCH_MESON) += meson-g12a-sei510.dtb
dtb-$(CONFIG_ARCH_MESON) += meson-g12a-u200.dtb
dtb-$(CONFIG_ARCH_MESON) += meson-g12a-x96-max.dtb
+dtb-$(CONFIG_ARCH_MESON) += meson-g12a-x96-max-rmii.dtb
dtb-$(CONFIG_ARCH_MESON) += meson-g12b-odroid-n2.dtb
dtb-$(CONFIG_ARCH_MESON) += meson-gxbb-nanopi-k2.dtb
dtb-$(CONFIG_ARCH_MESON) += meson-gxbb-nexbox-a95x.dtb
diff --git a/arch/arm64/boot/dts/amlogic/meson-g12a-x96-max-rmii.dts b/arch/arm64/boot/dts/amlogic/meson-g12a-x96-max-rmii.dts
new file mode 100644
index 000000000000..72751bfe88d3
--- /dev/null
+++ b/arch/arm64/boot/dts/amlogic/meson-g12a-x96-max-rmii.dts
@@ -0,0 +1,281 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2018 BayLibre SAS. All rights reserved.
+ */
+
+/dts-v1/;
+
+#include "meson-g12a.dtsi"
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/gpio/meson-g12a-gpio.h>
+
+/ {
+ compatible = "amediatech,x96-max-rmii", "amlogic,u200", "amlogic,g12a";
+ model = "Shenzhen Amediatech Technology Co., Ltd X96 Max";
+
+ aliases {
+ serial0 = &uart_AO;
+ ethernet0 = &ethmac;
+ };
+ chosen {
+ stdout-path = "serial0:115200n8";
+ };
+ memory@0 {
+ device_type = "memory";
+ reg = <0x0 0x0 0x0 0x40000000>;
+ };
+
+ cvbs-connector {
+ compatible = "composite-video-connector";
+
+ port {
+ cvbs_connector_in: endpoint {
+ remote-endpoint = <&cvbs_vdac_out>;
+ };
+ };
+ };
+
+ hdmi-connector {
+ compatible = "hdmi-connector";
+ type = "a";
+
+ port {
+ hdmi_connector_in: endpoint {
+ remote-endpoint = <&hdmi_tx_tmds_out>;
+ };
+ };
+ };
+
+ emmc_pwrseq: emmc-pwrseq {
+ compatible = "mmc-pwrseq-emmc";
+ reset-gpios = <&gpio BOOT_12 GPIO_ACTIVE_LOW>;
+ };
+
+ sdio_pwrseq: sdio-pwrseq {
+ compatible = "mmc-pwrseq-simple";
+ reset-gpios = <&gpio GPIOX_6 GPIO_ACTIVE_LOW>;
+ clocks = <&wifi32k>;
+ clock-names = "ext_clock";
+ };
+
+ flash_1v8: regulator-flash_1v8 {
+ compatible = "regulator-fixed";
+ regulator-name = "FLASH_1V8";
+ regulator-min-microvolt = <1800000>;
+ regulator-max-microvolt = <1800000>;
+ vin-supply = <&vcc_3v3>;
+ regulator-always-on;
+ };
+
+ dc_in: regulator-dc_in {
+ compatible = "regulator-fixed";
+ regulator-name = "DC_IN";
+ regulator-min-microvolt = <5000000>;
+ regulator-max-microvolt = <5000000>;
+ regulator-always-on;
+ };
+
+ vcc_1v8: regulator-vcc_1v8 {
+ compatible = "regulator-fixed";
+ regulator-name = "VCC_1V8";
+ regulator-min-microvolt = <1800000>;
+ regulator-max-microvolt = <1800000>;
+ vin-supply = <&vcc_3v3>;
+ regulator-always-on;
+ };
+
+ vcc_3v3: regulator-vcc_3v3 {
+ compatible = "regulator-fixed";
+ regulator-name = "VCC_3V3";
+ regulator-min-microvolt = <3300000>;
+ regulator-max-microvolt = <3300000>;
+ vin-supply = <&vddao_3v3>;
+ regulator-always-on;
+ /* FIXME: actually controlled by VDDCPU_B_EN */
+ };
+
+ vcc_5v: regulator-vcc_5v {
+ compatible = "regulator-fixed";
+ regulator-name = "VCC_5V";
+ regulator-min-microvolt = <5000000>;
+ regulator-max-microvolt = <5000000>;
+ vin-supply = <&dc_in>;
+
+ gpio = <&gpio GPIOH_8 GPIO_OPEN_DRAIN>;
+ enable-active-low;
+ };
+
+ vddao_1v8: regulator-vddao_1v8 {
+ compatible = "regulator-fixed";
+ regulator-name = "VDDAO_1V8";
+ regulator-min-microvolt = <1800000>;
+ regulator-max-microvolt = <1800000>;
+ vin-supply = <&vddao_3v3>;
+ regulator-always-on;
+ };
+
+ vddao_3v3: regulator-vddao_3v3 {
+ compatible = "regulator-fixed";
+ regulator-name = "VDDAO_3V3";
+ regulator-min-microvolt = <3300000>;
+ regulator-max-microvolt = <3300000>;
+ vin-supply = <&dc_in>;
+ regulator-always-on;
+ };
+
+ wifi32k: wifi32k {
+ compatible = "pwm-clock";
+ #clock-cells = <0>;
+ clock-frequency = <32768>;
+ pwms = <&pwm_ef 0 30518 0>; /* PWM_E at 32.768KHz */
+ };
+};
+
+&cec_AO {
+ pinctrl-0 = <&cec_ao_a_h_pins>;
+ pinctrl-names = "default";
+ status = "disabled";
+ hdmi-phandle = <&hdmi_tx>;
+};
+
+&cecb_AO {
+ pinctrl-0 = <&cec_ao_b_h_pins>;
+ pinctrl-names = "default";
+ status = "okay";
+ hdmi-phandle = <&hdmi_tx>;
+};
+
+&cvbs_vdac_port {
+ cvbs_vdac_out: endpoint {
+ remote-endpoint = <&cvbs_connector_in>;
+ };
+};
+
+&hdmi_tx {
+ status = "okay";
+ pinctrl-0 = <&hdmitx_hpd_pins>, <&hdmitx_ddc_pins>;
+ pinctrl-names = "default";
+ hdmi-supply = <&vcc_5v>;
+};
+
+&hdmi_tx_tmds_port {
+ hdmi_tx_tmds_out: endpoint {
+ remote-endpoint = <&hdmi_connector_in>;
+ };
+};
+
+&ir {
+ status = "okay";
+ pinctrl-0 = <&remote_input_ao_pins>;
+ pinctrl-names = "default";
+ linux,rc-map-name = "rc-x96max";
+};
+
+&ext_mdio {
+ external_phy: ethernet-phy@0 {
+ compatible = "ethernet-phy-id001c.c916", "ethernet-phy-ieee802.3-c22";
+ reg = <0>;
+ max-speed = <1000>;
+ eee-broken-1000t;
+ };
+};
+
+&ethmac {
+ status = "okay";
+ pinctrl-0 = <&eth_leds_pins>;
+ pinctrl-names = "default";
+ phy-handle = <&internal_ephy>;
+ phy-mode = "rmii";
+};
+
+&pwm_ef {
+ status = "okay";
+ pinctrl-0 = <&pwm_e_pins>;
+ pinctrl-names = "default";
+};
+
+&uart_A {
+ status = "okay";
+ pinctrl-0 = <&uart_a_pins>, <&uart_a_cts_rts_pins>;
+ pinctrl-names = "default";
+ uart-has-rtscts;
+
+ bluetooth {
+ compatible = "brcm,bcm43438-bt";
+ shutdown-gpios = <&gpio GPIOX_17 GPIO_ACTIVE_HIGH>;
+ };
+};
+
+&uart_AO {
+ status = "okay";
+ pinctrl-0 = <&uart_ao_a_pins>;
+ pinctrl-names = "default";
+};
+
+&usb {
+ status = "okay";
+ dr_mode = "host";
+};
+
+/* SDIO */
+&sd_emmc_a {
+ status = "okay";
+ pinctrl-0 = <&sdio_pins>;
+ pinctrl-1 = <&sdio_clk_gate_pins>;
+ pinctrl-names = "default", "clk-gate";
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ bus-width = <4>;
+ cap-sd-highspeed;
+ sd-uhs-sdr50;
+ max-frequency = <100000000>;
+
+ non-removable;
+ disable-wp;
+
+ mmc-pwrseq = <&sdio_pwrseq>;
+
+ vmmc-supply = <&vddao_3v3>;
+ vqmmc-supply = <&vddao_1v8>;
+
+ brcmf: wifi@1 {
+ reg = <1>;
+ compatible = "brcm,bcm4329-fmac";
+ };
+};
+
+/* SD card */
+&sd_emmc_b {
+ status = "okay";
+ pinctrl-0 = <&sdcard_c_pins>;
+ pinctrl-1 = <&sdcard_clk_gate_c_pins>;
+ pinctrl-names = "default", "clk-gate";
+
+ bus-width = <4>;
+ cap-sd-highspeed;
+ max-frequency = <100000000>;
+ disable-wp;
+
+ cd-gpios = <&gpio GPIOC_6 GPIO_ACTIVE_LOW>;
+ vmmc-supply = <&vddao_3v3>;
+ vqmmc-supply = <&vddao_3v3>;
+};
+
+/* eMMC */
+&sd_emmc_c {
+ status = "okay";
+ pinctrl-0 = <&emmc_pins>, <&emmc_ds_pins>;
+ pinctrl-1 = <&emmc_clk_gate_pins>;
+ pinctrl-names = "default", "clk-gate";
+
+ bus-width = <8>;
+ cap-mmc-highspeed;
+ max-frequency = <100000000>;
+ non-removable;
+ disable-wp;
+
+ mmc-pwrseq = <&emmc_pwrseq>;
+ vmmc-supply = <&vcc_3v3>;
+ vqmmc-supply = <&flash_1v8>;
+};
--
2.17.1

View File

@ -31,6 +31,17 @@ devices = {
'orangepi_3' : { 'dtb' : 'sun50i-h6-orangepi-3.dtb', 'config' : 'orangepi_3_defconfig' },
},
},
'Amlogic' : {
'AMLGX' : {
'box' : { 'dtb' : 'meson-gxl-s905x-p212.dtb', 'config' : 'p212_defconfig' },
'lepotato' : { 'dtb' : 'meson-gxl-s905x-libretech-cc.dtb', 'config' : 'libretech-cc_defconfig' },
'nanopi-k2' : { 'dtb' : 'meson-gxbb-nanopi-k2.dtb', 'config' : 'nanopi-k2_defconfig' },
'odroid-c2' : { 'dtb' : 'meson-gxbb-odroidc2.dtb', 'config' : 'odroid-c2_defconfig' },
},
'AMLG12' : {
'box' : { 'dtb' : 'meson-gxl-s905x-p212.dtb', 'config' : 'p212_defconfig' },
},
},
'Rockchip' : {
'MiQi' : { 'rk3288' : { 'dtb' : 'rk3288-miqi.dtb', 'config' : 'miqi-rk3288_config' }, },
'RK3328' : {