Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

projects/Amlogic: add support for S912 devices #2400

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
119 changes: 119 additions & 0 deletions projects/Amlogic/devices/S912/initramfs/platform_init
@@ -0,0 +1,119 @@
#!/bin/sh

################################################################################
# This file is part of LibreELEC - https://libreelec.tv
# Copyright (C) 2017-present Team LibreELEC
#
# LibreELEC is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# LibreELEC is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with LibreELEC. If not, see <http://www.gnu.org/licenses/>.
################################################################################

display_mode=$(cat /sys/class/display/mode)

for arg in $(cat /proc/cmdline); do
case ${arg} in
bootfrom*)
bootfromext=1
;;
BOOT_IMAGE=*)
BOOT_IMAGE=${arg#*=}
;;
boot=*)
boot=${arg#*=}
;;
disk=*)
disk=${arg#*=}
;;
hdmimode=*)
hdmimode=${arg#*=}
;;
esac
done

# Force 1080p60hz HDMI mode for S912
hdmimode="1080p60hz"

# Add information where to run LibreELEC from
if [ -z "$BOOT_IMAGE" -o -z "$boot" -o -z "$disk" ]; then
cmdline=$(cat /proc/cmdline)
if [ -n "$bootfromext" ]; then
cmdline="$cmdline BOOT_IMAGE=kernel.img boot=LABEL=LIBREELEC disk=LABEL=STORAGE"
else
cmdline="$cmdline BOOT_IMAGE=/dev/boot boot=/dev/system disk=/dev/data"
fi
echo "$cmdline" > /proc/cmdline
fi

# Enable HDMI output if cable is connected and not already enabled by u-boot
if [ "$(cat /sys/class/amhdmitx/amhdmitx0/hpd_state)" != "0" ] && [ "$display_mode" != "$hdmimode" ]; then
echo "$hdmimode" > /sys/class/display/mode
display_mode="$hdmimode"
fi

# Set framebuffer geometry to match the resolution
case $hdmimode in
480*) X=720 Y=480 ;;
576*) X=720 Y=576 ;;
720p*) X=1280 Y=720 ;;
*) X=1920 Y=1080 ;;
esac

fbset -fb /dev/fb0 -g $X $Y 1920 2160 32
fbset -fb /dev/fb1 -g 32 32 32 32 32
echo 0 > /sys/class/graphics/fb0/free_scale
echo 0 > /sys/class/graphics/fb1/free_scale
echo 1 > /sys/class/video/disable_video

# Enable scaling for 4K output
case $hdmimode in
4k*|smpte*|2160*)
echo 0 0 1919 1079 > /sys/class/graphics/fb0/free_scale_axis
echo 0 0 3839 2159 > /sys/class/graphics/fb0/window_axis
echo 1920 > /sys/class/graphics/fb0/scale_width
echo 1080 > /sys/class/graphics/fb0/scale_height
echo 0x10001 > /sys/class/graphics/fb0/free_scale
;;
esac

# Include deinterlacer into default VFM map
echo rm default > /sys/class/vfm/map
echo add default decoder ppmgr deinterlace amvideo > /sys/class/vfm/map

# Enable framebuffer device
echo 0 > /sys/class/graphics/fb0/blank

# Blank fb1 to prevent static noise
echo 1 > /sys/class/graphics/fb1/blank

for part in /sys/block/*/queue/add_random; do
echo 0 > "$part"
done

# Set 1GHz minimum CPU speed for both clusters
echo 1000000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
echo 1000000 > /sys/devices/system/cpu/cpu4/cpufreq/scaling_min_freq

# set smp_affinity
# Binary Hex
# CPU 0 0001 1
# CPU 1 0010 2
# CPU 2 0100 4
# CPU 3 1000 8
echo 2 > /proc/irq/231/smp_affinity # hdmi_aocec
echo 4 > /proc/irq/63/smp_affinity # dwc_otg, dwc_otg_hcd:usb1
echo 8 > /proc/irq/62/smp_affinity # dwc_otg, dwc_otg_hcd:usb2, dwc_otg_pcd

# DEC_CONTROL_FLAG_DISABLE_FAST_POC
echo 4 > /sys/module/amvdec_h264/parameters/dec_control

echo 1 > /sys/devices/system/cpu/cpufreq/ondemand/io_is_busy
16 changes: 16 additions & 0 deletions projects/Amlogic/devices/S912/options
@@ -0,0 +1,16 @@
# Kernel extra targets to build
KERNEL_UBOOT_EXTRA_TARGET="gxm_q200_2g.dtb gxm_q201_1g.dtb gxm_q201_2g.dtb"

# OpenGL-ES implementation to use (no / bcm2835-driver / gpu-viv-bin-mx6q / opengl-meson)
OPENGLES="opengl-meson-t82x"

# additional drivers to install:
# for a list of additinoal drivers see packages/linux-drivers
# Space separated list is supported,
# e.g. ADDITIONAL_DRIVERS="DRIVER1 DRIVER2"
ADDITIONAL_DRIVERS="$ADDITIONAL_DRIVERS gpu-aml-t8xx"

# additional packages to install:
# Space separated list is supported,
# e.g. ADDITIONAL_PACKAGES="PACKAGE1 PACKAGE2"
ADDITIONAL_PACKAGES="u-boot-tools-aml"
29 changes: 29 additions & 0 deletions projects/Amlogic/devices/S912/packages/android-headers/package.mk
@@ -0,0 +1,29 @@
################################################################################
# This file is part of LibreELEC - https://libreelec.tv
# Copyright (C) 2017-present Team LibreELEC
#
# LibreELEC is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# LibreELEC is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with LibreELEC. If not, see <http://www.gnu.org/licenses/>.
################################################################################

PKG_NAME="android-headers"
PKG_VERSION="25"
PKG_SHA256="1e0ecdf56c33aaa523109254e2c475878d8cfc5795ebd4bb5ecbaf80926f4fe9"
PKG_ARCH="any"
PKG_LICENSE="Apache"
PKG_SITE="https://android.googlesource.com/"
PKG_URL="https://kszaq.libreelec.tv/sources/${PKG_NAME}-${PKG_VERSION}.tar.gz"
PKG_DEPENDS_TARGET="toolchain"
PKG_SECTION="devel"
PKG_SHORTDESC="android-headers: Android Platform Headers from AOSP releases"
PKG_TOOLCHAIN="manual"
45 changes: 45 additions & 0 deletions projects/Amlogic/devices/S912/packages/gpu-aml-t8xx/package.mk
@@ -0,0 +1,45 @@
################################################################################
# This file is part of LibreELEC - https://libreelec.tv
# Copyright (C) 2017-present Team LibreELEC
#
# LibreELEC is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# LibreELEC is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with LibreELEC. If not, see <http://www.gnu.org/licenses/>.
################################################################################

PKG_NAME="gpu-aml-t8xx"
PKG_VERSION="fe7a4d8"
PKG_SHA256="518f855a2b191e50d09c2d0b3e671b5ed4b5e4db06aa3a718e29ef30cc0d9a57"
PKG_ARCH="arm aarch64"
PKG_LICENSE="GPL"
PKG_SITE="http://openlinux.amlogic.com:8000/download/ARM/gpu/"
PKG_URL="https://github.com/khadas/android_hardware_arm_gpu/archive/$PKG_VERSION.tar.gz"
PKG_SOURCE_DIR="android_hardware_arm_gpu-$PKG_VERSION*"
PKG_DEPENDS_TARGET="toolchain linux"
PKG_NEED_UNPACK="$LINUX_DEPENDS"
PKG_SECTION="driver"
PKG_SHORTDESC="gpu-aml: Linux drivers for Mali GPUs found in Amlogic Meson SoCs"
PKG_LONGDESC="gpu-aml: Linux drivers for Mali GPUs found in Amlogic Meson SoCs"
PKG_IS_KERNEL_PKG="yes"
PKG_TOOLCHAIN="manual"

make_target() {
LDFLAGS="" make -C $(kernel_path) M=$PKG_BUILD/t83x/kernel/drivers/gpu/arm/midgard \
EXTRA_CFLAGS="-DCONFIG_MALI_PLATFORM_DEVICETREE -DCONFIG_MALI_MIDGARD_DVFS -DCONFIG_MALI_BACKEND=gpu" \
CONFIG_MALI_MIDGARD=m CONFIG_MALI_PLATFORM_DEVICETREE=y CONFIG_MALI_MIDGARD_DVFS=y CONFIG_MALI_BACKEND=gpu modules
}

makeinstall_target() {
LDFLAGS="" make -C $(kernel_path) M=$PKG_BUILD/t83x/kernel/drivers/gpu/arm/midgard \
INSTALL_MOD_PATH=$INSTALL/$(get_kernel_overlay_dir) INSTALL_MOD_STRIP=1 DEPMOD=: \
modules_install
}
@@ -0,0 +1,12 @@
diff --git a/t83x/kernel/drivers/gpu/arm/midgard/platform/devicetree/meson_main2.c b/t83x/kernel/drivers/gpu/arm/midgard/platform/devicetree/meson_main2.c
index 7687f92..7122448 100644
--- a/t83x/kernel/drivers/gpu/arm/midgard/platform/devicetree/meson_main2.c
+++ b/t83x/kernel/drivers/gpu/arm/midgard/platform/devicetree/meson_main2.c
@@ -68,6 +68,7 @@ inline int kbase_platform_dvfs_event(struct kbase_device *kbdev, u32 utilisation
mali_gpu_utilization_callback(utilisation*255/100);
return 1;
}
+EXPORT_SYMBOL(kbase_platform_dvfs_event);

struct kbase_platform_funcs_conf dt_funcs_conf = {
.platform_init_func = platform_dt_init_func,
@@ -0,0 +1,28 @@
diff --git a/t83x/kernel/drivers/gpu/arm/midgard/platform/devicetree/mali_clock.c b/t83x/kernel/drivers/gpu/arm/midgard/platform/devicetree/mali_clock.c
index 6ddf39f..370eb16 100644
--- a/t83x/kernel/drivers/gpu/arm/midgard/platform/devicetree/mali_clock.c
+++ b/t83x/kernel/drivers/gpu/arm/midgard/platform/devicetree/mali_clock.c
@@ -339,8 +339,8 @@ int mali_dt_info(struct platform_device *pdev, struct mali_plat_info_t *mpdata)
ret = of_property_read_u32(gpu_dn,"def_clk",
&mpdata->def_clock);
if (ret) {
- dev_notice(&pdev->dev, "default clk set to %d\n", mpdata->dvfs_table_size/2-1);
- mpdata->def_clock = mpdata->dvfs_table_size/2 - 1;
+ dev_notice(&pdev->dev, "default clk set to %d\n", mpdata->turbo_clock);
+ mpdata->def_clock = mpdata->turbo_clock;
}
_dev_info(&pdev->dev, "default clk is %d\n", mpdata->def_clock);

diff --git a/t83x/kernel/drivers/gpu/arm/midgard/platform/devicetree/scaling.c b/t83x/kernel/drivers/gpu/arm/midgard/platform/devicetree/scaling.c
index 16fe365..3e4508f 100644
--- a/t83x/kernel/drivers/gpu/arm/midgard/platform/devicetree/scaling.c
+++ b/t83x/kernel/drivers/gpu/arm/midgard/platform/devicetree/scaling.c
@@ -29,7 +29,7 @@ static int lastStep;
static struct work_struct wq_work;
static mali_plat_info_t* pmali_plat = NULL;
#endif
-static int scaling_mode = MALI_PP_FS_SCALING;
+static int scaling_mode = MALI_TURBO_MODE;
extern int mali_pm_statue;
//static int scaling_mode = MALI_SCALING_DISABLE;
//static int scaling_mode = MALI_PP_SCALING;
36 changes: 36 additions & 0 deletions projects/Amlogic/devices/S912/packages/libhybris/package.mk
@@ -0,0 +1,36 @@
################################################################################
# This file is part of LibreELEC - https://libreelec.tv
# Copyright (C) 2017-present Team LibreELEC
#
# LibreELEC is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# LibreELEC is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with LibreELEC. If not, see <http://www.gnu.org/licenses/>.
################################################################################

PKG_NAME="libhybris"
PKG_VERSION="070c3ab"
PKG_SHA256="070dcf48aa424c1c56c1d95f5116051a22a76bd5ac0c877febf04b63d9559ea2"
PKG_ARCH="any"
PKG_LICENSE="GPL"
PKG_SITE="https://github.com/libhybris/libhybris"
PKG_URL="https://github.com/libhybris/libhybris/archive/$PKG_VERSION.tar.gz"
PKG_SOURCE_DIR="$PKG_NAME-$PKG_VERSION*/hybris"
PKG_DEPENDS_TARGET="toolchain android-headers"
PKG_SECTION="devel"
PKG_SHORTDESC="libhybris: Allows to run bionic-based HW adaptations in glibc systems - libs"
PKG_TOOLCHAIN="autotools"

PKG_CONFIGURE_OPTS_TARGET="--enable-arch=$TARGET_ARCH \
--with-default-egl-platform=fbdev \
--with-android-headers=$BUILD/android-headers-25 \
--with-default-hybris-ld-library-path=/system/lib \
--enable-mali-quirks"
@@ -0,0 +1,19 @@
diff --git a/Makefile.am b/Makefile.am
index 906140e..75888ae 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -6,13 +6,7 @@ endif
if HAS_ANDROID_5_0_0
SUBDIRS += libsync
endif
-SUBDIRS += egl glesv1 glesv2 ui sf input camera vibrator media wifi
-
-if HAS_LIBNFC_NXP_HEADERS
-SUBDIRS += libnfc_nxp libnfc_ndef_nxp
-endif
-SUBDIRS += utils tests
-
+SUBDIRS += egl glesv1 glesv2

MAINTAINERCLEANFILES = \
aclocal.m4 compile config.guess config.sub \
@@ -0,0 +1,40 @@
################################################################################
# This file is part of LibreELEC - https://libreelec.tv
# Copyright (C) 2017-present Team LibreELEC
#
# LibreELEC is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# LibreELEC is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with LibreELEC. If not, see <http://www.gnu.org/licenses/>.
################################################################################

PKG_NAME="opengl-meson-t82x"
PKG_VERSION="915cb48"
PKG_SHA256="9b5f65afa21250b67578c250da030a5829e69131ce91b2f167b01b1ed30be781"
PKG_ARCH="arm"
PKG_LICENSE="nonfree"
PKG_SITE="https://github.com/kszaq/opengl-meson-t82x"
PKG_URL="https://github.com/kszaq/opengl-meson-t82x/archive/$PKG_VERSION.tar.gz"
PKG_DEPENDS_TARGET="toolchain libhybris"
PKG_SOURCE_DIR="$PKG_NAME-$PKG_VERSION*"
PKG_SECTION="graphics"
PKG_SHORTDESC="opengl-meson: OpenGL ES pre-compiled libraries for Mali GPUs found in Amlogic Meson SoCs"
PKG_LONGDESC="opengl-meson: OpenGL ES pre-compiled libraries for Mali GPUs found in Amlogic Meson SoCs. The libraries could be found in a Linux buildroot released by Amlogic at http://openlinux.amlogic.com:8000/download/ARM/filesystem/. See the opengl package."
PKG_TOOLCHAIN="manual"

makeinstall_target() {
mkdir -p $INSTALL/system
cp -a system/* $INSTALL/system
}

post_install() {
enable_service unbind-console.service
}
@@ -0,0 +1,11 @@
[Unit]
Description=Unbind framebuffer console

ConditionPathExists=/sys/class/vtconsole/vtcon1/bind

[Service]
Type=oneshot
ExecStart=/bin/sh -c 'echo 0 > /sys/class/vtconsole/vtcon1/bind'

[Install]
WantedBy=graphical.target