Added LG G Watch R (lg-lenok) Support (#489)

* added LG G Watch R (also compatible with Urbane 1)
* added frame buffer fix script to install
* Added missing refreshrate patch
* Added xwayland
This commit is contained in:
James Heald 2017-09-01 23:20:09 +01:00 committed by Oliver Smith
parent da3a164992
commit b53a18ed23
9 changed files with 3630 additions and 0 deletions

View file

@ -0,0 +1,4 @@
# use 'weston-calibrator' to calibrate the touchscreen!
SUBSYSTEM=="input", ATTRS{name}=="synaptics_rmi4_i2c", \
ENV{ID_INPUT}="1", ENV{ID_INPUT_TOUCHSCREEN}="1" \
ENV{WL_CALIBRATION}="0.982113 -0.006129 1.983124 -0.002560 1.000800 -6.012451"

View file

@ -0,0 +1,33 @@
pkgname=device-lg-lenok
pkgver=1
pkgrel=2
pkgdesc="LG G Watch R"
url="https://github.com/postmarketOS"
arch="noarch"
license="MIT"
depends="linux-lg-lenok mkbootimg"
makedepends=""
install=""
subpackages=""
source="deviceinfo initfs-hook.sh 90-android-touch-dev.rules fb_fix.sh"
options="!check"
build() {
return 0
}
package() {
install -D -m644 "$srcdir"/deviceinfo \
"$pkgdir"/etc/deviceinfo
install -D -m644 "$srcdir"/initfs-hook.sh \
"$pkgdir"/etc/postmarketos-mkinitfs/hooks/00-${pkgname}.sh
install -D -m644 "$srcdir"/90-android-touch-dev.rules \
"$pkgdir"/etc/udev/rules.d/90-android-touch-dev.rules
install -D -m644 "$srcdir"/fb_fix.sh \
"$pkgdir"/etc/profile.d/fb_fix.sh
}
sha512sums="9dba843fba4f942587e858631939c6a08f30c23a08e29028a8739d5ac0a8c5e67e6df18758c3f2e75f48eab9181300438ec604ce259b5d7342ce6a1d0a5e2a66 deviceinfo
e2b0a6c02a0073094439aa7014139fa567b8375b442eaad00d6c1b90a1fd2d9bc73bf4546137fe2dd5c9de03a6ec383173d1b4ad3ab975850484c4e1342cfb74 initfs-hook.sh
a36ba9017df3b4be233783096c303abafa873dcdf50f6357b82f3c5526fd161a1914dafe143377cb5982955108b987890638b51911d0dd339172554e39a82d9f 90-android-touch-dev.rules
f623da68a750ba5dd367d131841aca182b5041292c800e0c919d25187305546e9e42b876cadadc2f56b73e0e6b718a9149a817f5d571e015f7c9467f7387aa61 fb_fix.sh"

View file

@ -0,0 +1,29 @@
# Reference: <https://postmarketos.org/deviceinfo>
# Please use double quotes only. You can source this file in shell scripts.
deviceinfo_format_version="0"
deviceinfo_name="G Watch R"
deviceinfo_manufacturer="LG"
deviceinfo_date=""
deviceinfo_keyboard="false"
deviceinfo_nonfree="????"
deviceinfo_dtb=""
deviceinfo_modules_initfs=""
deviceinfo_external_disk="false"
deviceinfo_external_disk_install="false"
deviceinfo_flash_methods="fastboot"
deviceinfo_arch="armhf"
# Splash screen
deviceinfo_screen_width="320"
deviceinfo_screen_height="320"
# Fastboot related
deviceinfo_generate_bootimg="true"
deviceinfo_flash_offset_kernel="0x0000000"
deviceinfo_flash_offset_ramdisk="0x02000000"
deviceinfo_flash_offset_second="0x00f00000"
deviceinfo_flash_offset_tags="0x01e00000"
deviceinfo_flash_pagesize="2048"
deviceinfo_weston_core_modules="xwayland.so"

View file

@ -0,0 +1,15 @@
main() {
# Wait untill graphical enviroment is running
sleep 5
# Workaround for buggy graphics driver
while [ ! ];
do
echo '0,0' > /sys/class/graphics/fb0/pan;
done
}
# tty1 autologin
if [ $(tty) = "/dev/tty1" ]; then
# Run in background, to make /etc/profile not wait for it to finish
main &
fi

View file

@ -0,0 +1,5 @@
#!/bin/sh
# set framebuffer resolution
cat /sys/class/graphics/fb0/modes > /sys/class/graphics/fb0/mode
echo 320,320 > /sys/class/graphics/fb0/virtual_size

View file

@ -0,0 +1,109 @@
# APKBUILD based on linux-vanilla aport. Changes:
# - disabled module installation
# - add !check !tracedeps
# - package: just install zimage and kernel.release, because the kernel config
# does not generate modules or dtb files
# - do not create -dev subpackage (makes no sense without module support)
#
# Changes:
# - enable devtmpfs (needed for udev -> touch support in weston)
# - enabled CONFIG_VT (needed for weston to work)
# - Added ata2001's refresh rate fix for 60hz (otherwise screen is stuck at 15hz)
# - Enable generation of dtb
_vendor=lge
_flavor=lg-lenok
_hash="f383838578f56e03687c81ac7d6de12eafbd85f4"
_config="config-${_flavor}.armhf"
pkgname=linux-${_flavor}
pkgver=3.10.105
case $pkgver in
*.*.*) _kernver=${pkgver%.*};;
*.*) _kernver=$pkgver;;
esac
pkgrel=4
arch="armhf"
pkgdesc="G Watch R kernel"
url="https://github.com/Tsunamical/kernel_lge_bass-lenok"
depends="postmarketos-mkinitfs"
makedepends="perl sed installkernel bash gmp-dev bc linux-headers elfutils-dev"
options="!strip !check !tracedeps"
install=
source="
$pkgname-$_hash.tar.gz::${url}/archive/${_hash}.tar.gz
$_config
compiler-gcc6.h
refresh_rate.patch
"
subpackages=""
license="GPL2"
_abi_release=${pkgver}
_carch="arm"
HOSTCC="${CC:-gcc}"
HOSTCC="${HOSTCC#${CROSS_COMPILE}}"
ksrcdir="$srcdir/kernel_lge_bass-lenok-${_hash}"
prepare() {
local _patch_failed=
cd "$ksrcdir"
# first apply patches in specified order
for i in $source; do
case $i in
*.patch)
msg "Applying $i..."
if ! patch -s -p1 -N -i "$srcdir"/$i; then
echo $i >>failed
_patch_failed=1
fi
;;
esac
done
if ! [ -z "$_patch_failed" ]; then
error "The following patches failed:"
cat failed
return 1
fi
# gcc6 support
cp -v "$srcdir/compiler-gcc6.h" "$ksrcdir/include/linux/"
mkdir -p "$srcdir"/build
cp "$srcdir"/$_config "$srcdir"/build/.config || return 1
make -C "$ksrcdir" O="$srcdir"/build ARCH="$_carch" HOSTCC="$HOSTCC" \
silentoldconfig
}
# this is so we can do: 'abuild menuconfig' to reconfigure kernel
menuconfig() {
cd "$srcdir"/build || return 1
make ARCH="$_carch" menuconfig
cp .config "$startdir"/$_config
}
build() {
cd "$srcdir"/build
unset LDFLAGS
make ARCH="$_carch" CC="${CC:-gcc}" \
KBUILD_BUILD_VERSION="$((pkgrel + 1 ))-Alpine" \
|| return 1
}
package() {
install -Dm644 "$srcdir/build/arch/arm/boot/zImage-dtb" \
"$pkgdir/boot/vmlinuz-$_flavor"
install -D "$srcdir/build/include/config/kernel.release" \
"$pkgdir/usr/share/kernel/$_flavor/kernel.release"
}
sha512sums="4b639fcb5baf60ddc16bca43450d8d7dead6fdfdfab5da13ab2ffc8ae25056610de1aee0abc57737f3d4ac7417685bcefd2303c34b110ce749e1d65abbcf8bee linux-lg-lenok-f383838578f56e03687c81ac7d6de12eafbd85f4.tar.gz
2ca943fca8eefeacb0e8677ed3db5c0e27b0a643cb4b54afa0750df1f9accd23a9bd194905cf1cac6a8d1fae3aa480edd24ff737ad7e230de351c30a9400e592 config-lg-lenok.armhf
d80980e9474c82ba0ef1a6903b434d8bd1b092c40367ba543e72d2c119301c8b2d05265740e4104ca1ac5d15f6c4aa49e8776cb44264a9a28dc551e0d1850dcc compiler-gcc6.h
2ab69ffa7940611fbaeba3f5ccca89e53530ea4603c815b329f137e717c2812e1049e29996d74f963d7d67166d1529589f6272367e77ee1e467e437661be1d12 refresh_rate.patch"

View file

@ -0,0 +1,69 @@
// SOURCE:
// https://github.com/NextThingCo/CHIP-u-boot/issues/10#issuecomment-287515505
#ifndef __LINUX_COMPILER_H
#error "Please don't include <linux/compiler-gcc6.h> directly, include <linux/compiler.h> instead."
#endif
#define __used __attribute__((__used__))
#define __must_check __attribute__((warn_unused_result))
#define __compiler_offsetof(a, b) __builtin_offsetof(a, b)
/* Mark functions as cold. gcc will assume any path leading to a call
to them will be unlikely. This means a lot of manual unlikely()s
are unnecessary now for any paths leading to the usual suspects
like BUG(), printk(), panic() etc. [but let's keep them for now for
older compilers]
Early snapshots of gcc 4.3 don't support this and we can't detect this
in the preprocessor, but we can live with this because they're unreleased.
Maketime probing would be overkill here.
gcc also has a __attribute__((__hot__)) to move hot functions into
a special section, but I don't see any sense in this right now in
the kernel context */
#define __cold __attribute__((__cold__))
#define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
#ifndef __CHECKER__
# define __compiletime_warning(message) __attribute__((warning(message)))
# define __compiletime_error(message) __attribute__((error(message)))
#endif /* __CHECKER__ */
/*
* Mark a position in code as unreachable. This can be used to
* suppress control flow warnings after asm blocks that transfer
* control elsewhere.
*
* Early snapshots of gcc 4.5 don't support this and we can't detect
* this in the preprocessor, but we can live with this because they're
* unreleased. Really, we need to have autoconf for the kernel.
*/
#define unreachable() __builtin_unreachable()
/* Mark a function definition as prohibited from being cloned. */
#define __noclone __attribute__((__noclone__))
/*
* Tell the optimizer that something else uses this function or variable.
*/
#define __visible __attribute__((externally_visible))
/*
* GCC 'asm goto' miscompiles certain code sequences:
*
* http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58670
*
* Work it around via a compiler barrier quirk suggested by Jakub Jelinek.
*
* (asm goto is automatically volatile - the naming reflects this.)
*/
#define asm_volatile_goto(x...) do { asm goto(x); asm (""); } while (0)
#ifdef CONFIG_ARCH_USE_BUILTIN_BSWAP
#define __HAVE_BUILTIN_BSWAP32__
#define __HAVE_BUILTIN_BSWAP64__
#define __HAVE_BUILTIN_BSWAP16__
#endif /* CONFIG_ARCH_USE_BUILTIN_BSWAP */

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,13 @@
diff --git a/drivers/video/msm/mdss/mdss_fb.c b/drivers/video/msm/mdss/mdss_fb.c
index b37fd1e07ac1..1f091a261d22 100644
--- a/drivers/video/msm/mdss/mdss_fb.c
+++ b/drivers/video/msm/mdss/mdss_fb.c
@@ -2668,7 +2668,7 @@ static int mdss_fb_register(struct msm_fb_data_type *mfd)
var->left_margin = panel_info->lcdc.h_back_porch;
var->right_margin = panel_info->lcdc.h_front_porch;
var->hsync_len = panel_info->lcdc.h_pulse_width;
- var->pixclock = panel_info->clk_rate / 1000;
+ var->pixclock = 1000000 / 60;
/*
* Store the cont splash state in the var reserved[3] field.