Add LG G Watch (dory) support (#595)

* Add LG G Watch (dory) support

* Use github.com mirror instead of googlesource.com to have fixed checksum

* Fix kernel compilation and remove unnecessary initfs-hook for framebuffer settings
This commit is contained in:
drebrez 2017-09-19 01:15:04 +02:00 committed by Martijn Braam
parent 8e3ca34988
commit 3c988d76af
10 changed files with 3861 additions and 0 deletions

View file

@ -0,0 +1,7 @@
# udev rules file
# All device names can be read from weston's logfile (/tmp/weston.log in postmarketOS)
# Touchscreen detection
SUBSYSTEM=="input", ATTRS{name}=="synaptics_rmi4_i2c", \
ENV{ID_INPUT}="1", ENV{ID_INPUT_TOUCHSCREEN}="1"

View file

@ -0,0 +1,23 @@
pkgname=device-lg-dory
pkgver=1
pkgrel=0
pkgdesc="LG G Watch"
url="https://github.com/postmarketOS"
arch="noarch"
license="MIT"
depends="linux-lg-dory mkbootimg msm-fb-refresher"
makedepends=""
install=""
subpackages=""
source="deviceinfo 90-touchscreen-dev.rules"
options="!check"
package() {
install -D -m644 "$srcdir"/deviceinfo \
"$pkgdir"/etc/deviceinfo
install -D -m644 "$srcdir"/90-touchscreen-dev.rules \
"$pkgdir"/etc/udev/rules.d/90-touchscreen-dev.rules
}
sha512sums="68eedb9699db7e4abbcfa010271cac6b9b1b32bde170a7c3cfd598cfe51dc2c96837986175ddfb9c096521ca406f7b5c911afbafc41fb820c2d7333f34959b20 deviceinfo
4bd58ba3633d926fe8d1b1869b01173b44c5a66c75e8cc9220decf0bd395e1c20c746adf8f5f6761d67752e4b307cb65957bfaa01a631e42bf0860bebffbf347 90-touchscreen-dev.rules"

View file

@ -0,0 +1,31 @@
# 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"
deviceinfo_manufacturer="LG"
deviceinfo_date=""
deviceinfo_nonfree="????"
deviceinfo_dtb=""
deviceinfo_modules_initfs=""
deviceinfo_external_disk="false"
deviceinfo_external_disk_install="false"
deviceinfo_flash_methods="fastboot"
deviceinfo_arch="armhf"
deviceinfo_msm_refresher="true"
# Device related
deviceinfo_keyboard="false"
deviceinfo_screen_width="280"
deviceinfo_screen_height="280"
# Fastboot related
deviceinfo_generate_bootimg="true"
deviceinfo_flash_offset_base="0x00000000"
deviceinfo_flash_offset_kernel="0x00008000"
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,49 @@
From aeea3592a13bf12861943e44fc48f1f270941f8d Mon Sep 17 00:00:00 2001
From: Behan Webster <behanw@converseincode.com>
Date: Wed, 24 Sep 2014 01:06:46 +0100
Subject: [PATCH] ARM: 8158/1: LLVMLinux: use static inline in ARM ftrace.h
With compilers which follow the C99 standard (like modern versions of gcc and
clang), "extern inline" does the wrong thing (emits code for an externally
linkable version of the inline function). In this case using static inline
and removing the NULL version of return_address in return_address.c does
the right thing.
Signed-off-by: Behan Webster <behanw@converseincode.com>
Reviewed-by: Mark Charlebois <charlebm@gmail.com>
Acked-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
---
arch/arm/include/asm/ftrace.h | 2 +-
arch/arm/kernel/return_address.c | 5 -----
2 files changed, 1 insertion(+), 6 deletions(-)
diff --git a/arch/arm/include/asm/ftrace.h b/arch/arm/include/asm/ftrace.h
index 39eb16b0066f2..bfe2a2f5a644e 100644
--- a/arch/arm/include/asm/ftrace.h
+++ b/arch/arm/include/asm/ftrace.h
@@ -45,7 +45,7 @@ void *return_address(unsigned int);
#else
-extern inline void *return_address(unsigned int level)
+static inline void *return_address(unsigned int level)
{
return NULL;
}
diff --git a/arch/arm/kernel/return_address.c b/arch/arm/kernel/return_address.c
index fafedd86885dd..f6aa84d5b93c9 100644
--- a/arch/arm/kernel/return_address.c
+++ b/arch/arm/kernel/return_address.c
@@ -63,11 +63,6 @@ void *return_address(unsigned int level)
#warning "TODO: return_address should use unwind tables"
#endif
-void *return_address(unsigned int level)
-{
- return NULL;
-}
-
#endif /* if defined(CONFIG_FRAME_POINTER) && !defined(CONFIG_ARM_UNWIND) / else */
EXPORT_SYMBOL_GPL(return_address);

View file

@ -0,0 +1,47 @@
diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
index ed543c49..f6199747 100644
--- a/drivers/mmc/card/block.c
+++ b/drivers/mmc/card/block.c
@@ -1277,6 +1277,18 @@ static inline void mmc_blk_reset_success(struct mmc_blk_data *md, int type)
md->reset_done &= ~type;
}
+int mmc_access_rpmb(struct mmc_queue *mq)
+{
+ struct mmc_blk_data *md = mq->data;
+ /*
+ * If this is a RPMB partition access, return ture
+ */
+ if (md && md->part_type == EXT_CSD_PART_CONFIG_ACC_RPMB)
+ return true;
+
+ return false;
+}
+
static int mmc_blk_issue_discard_rq(struct mmc_queue *mq, struct request *req)
{
struct mmc_blk_data *md = mq->data;
diff --git a/drivers/mmc/card/queue.c b/drivers/mmc/card/queue.c
index e072f654..8dcff0eb 100644
--- a/drivers/mmc/card/queue.c
+++ b/drivers/mmc/card/queue.c
@@ -51,7 +51,7 @@ static int mmc_prep_request(struct request_queue *q, struct request *req)
return BLKPREP_KILL;
}
- if (mq && mmc_card_removed(mq->card))
+ if (mq && (mmc_card_removed(mq->card) || mmc_access_rpmb(mq)))
return BLKPREP_KILL;
req->cmd_flags |= REQ_DONTPREP;
diff --git a/drivers/mmc/card/queue.h b/drivers/mmc/card/queue.h
index d1fe01c1..f850c067 100644
--- a/drivers/mmc/card/queue.h
+++ b/drivers/mmc/card/queue.h
@@ -70,4 +70,6 @@ extern void mmc_queue_bounce_post(struct mmc_queue_req *);
extern void print_mmc_packing_stats(struct mmc_card *card);
+extern int mmc_access_rpmb(struct mmc_queue *);
+
#endif

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 60ac9cc..926e4a4 100644
--- a/drivers/video/msm/mdss/mdss_fb.c
+++ b/drivers/video/msm/mdss/mdss_fb.c
@@ -1921,7 +1921,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;
/*
* Populate smem length here for uspace to get the

View file

@ -0,0 +1,28 @@
diff --git a/drivers/video/msm/mdss/mdss_fb.c b/drivers/video/msm/mdss/mdss_fb.c
index 926e4a4..17e735f 100644
--- a/drivers/video/msm/mdss/mdss_fb.c
+++ b/drivers/video/msm/mdss/mdss_fb.c
@@ -2872,8 +2872,8 @@ static int mdss_fb_set_par(struct fb_info *info)
else
mfd->fbi->fix.line_length = var->xres * var->bits_per_pixel / 8;
- mfd->fbi->fix.smem_len = mfd->fbi->fix.line_length *
- mfd->fbi->var.yres_virtual;
+ /*mfd->fbi->fix.smem_len = mfd->fbi->fix.line_length *
+ mfd->fbi->var.yres_virtual;*/
if (mfd->panel_reconfig || (mfd->fb_imgType != old_imgType)) {
mdss_fb_blank_sub(FB_BLANK_POWERDOWN, info, mfd->op_enable);
diff --git a/drivers/video/msm/mdss/mdss_mdp.c b/drivers/video/msm/mdss/mdss_mdp.c
index 9e178d1..6b6044c 100644
--- a/drivers/video/msm/mdss/mdss_mdp.c
+++ b/drivers/video/msm/mdss/mdss_mdp.c
@@ -224,7 +224,7 @@ u32 mdss_mdp_fb_stride(u32 fb_index, u32 xres, int bpp)
is writing directly to fb0, the framebuffer pitch
also needs to be 32 pixel aligned */
- if (fb_index == 0)
+ if (fb_index == 1)
return ALIGN(xres, 32) * bpp;
else
return xres * bpp;

View file

@ -0,0 +1,87 @@
# APKBUILD based on linux-vanilla aport. Changes:
# - disabled module installation
# - add !check !tracedeps
# - package: just install zimage-dtb and kernel.release
#
# Kernel config based on: arch/arm/configs/dory_defconfig
# Changes:
# - apply patches to compile with gcc6
# - enable devtmpfs (needed for udev -> touch support in weston)
# - enabled CONFIG_VT (needed for weston to work)
_vendor=lge
_flavor=lg-dory
_hash="6924014484d3406e3d2da384efc20e40e8a5ae80"
_config="config-${_flavor}.armhf"
pkgname=linux-${_flavor}
pkgver=3.10.40
case $pkgver in
*.*.*) _kernver=${pkgver%.*};;
*.*) _kernver=$pkgver;;
esac
pkgrel=0
arch="armhf"
pkgdesc="Kernel for LG G Watch"
url="https://android.googlesource.com/kernel/msm/+/android-msm-dory-3.10-marshmallow-mr1-wear-release"
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::https://github.com/android/kernel_msm/archive/${_hash}.tar.gz
$_config
compiler-gcc6.h
00_fix_return_address.patch
01_avoid_rpmb_read_during_boot.patch
02_fix_mdss_fb_refresh_rate.patch
03_fix_mdss_fb_memory_allocation.patch
"
subpackages=""
license="GPL2"
_abi_release=${pkgver}
_carch="arm"
HOSTCC="${CC:-gcc}"
HOSTCC="${HOSTCC#${CROSS_COMPILE}}"
builddir="$srcdir/kernel_msm-${_hash}"
prepare() {
default_prepare
# gcc6 support
cp -v "$srcdir/compiler-gcc6.h" "$builddir/include/linux/"
cp "$srcdir"/$_config "$builddir"/.config
make ARCH="$_carch" HOSTCC="$HOSTCC" silentoldconfig
}
# this is so we can do: 'abuild menuconfig' to reconfigure kernel
menuconfig() {
cd "$builddir"
make ARCH="$_carch" menuconfig
cp .config "$startdir"/$_config
}
build() {
unset LDFLAGS
make ARCH="$_carch" CC="${CC:-gcc}" \
KBUILD_BUILD_VERSION="$((pkgrel + 1 ))-Alpine"
}
package() {
install -Dm644 "$builddir/arch/arm/boot/zImage-dtb" \
"$pkgdir/boot/vmlinuz-$_flavor"
install -D "$builddir/include/config/kernel.release" \
"$pkgdir/usr/share/kernel/$_flavor/kernel.release"
}
sha512sums="adc1e7852bebf3c11af87cfe9c994025e1415468be707664a25df33507d33de62125ab367dbc3f57ff84213ea479c2e8870d45603bc96df641b1bf853216201a linux-lg-dory-6924014484d3406e3d2da384efc20e40e8a5ae80.tar.gz
96c8ee4a206c69e794d976eab822ef0f827e52c082f59afad462f66f082f528e15a2b54841f5d67493b5a1d0d2b3ff1f69cc1dbb6c69d1b01cc4869a44963560 config-lg-dory.armhf
d80980e9474c82ba0ef1a6903b434d8bd1b092c40367ba543e72d2c119301c8b2d05265740e4104ca1ac5d15f6c4aa49e8776cb44264a9a28dc551e0d1850dcc compiler-gcc6.h
ea1d3b5a234fa565e3c1a792de48f4fc4e6023d281d303c8e319c7ef28edc5739ab0e4dea0139a41f0a5c7d03e27921ccaa214fd0ac5c72245a094ce60128864 00_fix_return_address.patch
760fdff79df31754ebed59839f34fc8c5a61750471614ac93a01b1e13b2535e7ca1f879c0cad3e83ad92946586c91679ba853eac4fe454d7e948317c84d81941 01_avoid_rpmb_read_during_boot.patch
26b599d6b0c435d9e0b80f578c1cc0714d60f532a98efbbcb0e313f5c5dcd2c8619afa5776091d14ea65e268a1f128b378fe30ba1743e1428f3300b505a9861c 02_fix_mdss_fb_refresh_rate.patch
5208c3f33099e22516e00ab90234784918157d0712a8a9cf81418a7ea1c136601cb54f83d490577f2cadb6ed94ac6c6f242e7b310fb5f09222de568e416c6731 03_fix_mdss_fb_memory_allocation.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