Xiaomi Cancro support

This commit is contained in:
Kieran Elmes 2018-08-02 22:14:59 +00:00 committed by Oliver Smith
parent 7cb471cb42
commit 8643198a04
13 changed files with 4230 additions and 0 deletions

View File

@ -0,0 +1,22 @@
# Reference: <https://postmarketos.org/devicepkg>
pkgname="device-xiaomi-cancro"
pkgdesc="Mi 3"
pkgver=0.1
pkgrel=0
url="https://postmarketos.org"
license="MIT"
arch="noarch"
options="!check"
depends="postmarketos-base linux-xiaomi-cancro mkbootimg mesa-dri-swrast msm-fb-refresher"
makedepends="devicepkg-dev"
source="deviceinfo"
build() {
devicepkg_build $startdir $pkgname
}
package() {
devicepkg_package $startdir $pkgname
}
sha512sums="37b15325b5ab5a1edc8598c308431a81e05f6bd13631952d3b9078f0a408da6d8f242253b08f851dc99f67df7c0b34210f5c4bb46a98f848d22e2081a809a16c deviceinfo"

View File

@ -0,0 +1,33 @@
# Reference: <https://postmarketos.org/deviceinfo>
# Please use double quotes only. You can source this file in shell scripts.
deviceinfo_format_version="0"
deviceinfo_name="Xiaomi Mi 3"
deviceinfo_manufacturer="Xiaomi"
deviceinfo_date=""
deviceinfo_dtb=""
deviceinfo_modules_initfs=""
deviceinfo_arch="armhf"
# Device related
deviceinfo_keyboard="false"
deviceinfo_external_storage="false"
deviceinfo_screen_width="1080"
deviceinfo_screen_height="1920"
deviceinfo_dev_touchscreen="/dev/input/event2"
deviceinfo_dev_touchscreen_calibration=""
deviceinfo_dev_keyboard=""
deviceinfo_weston_pixman_type="2"
# Bootloader related
deviceinfo_flash_method="fastboot"
deviceinfo_kernel_cmdline="console=none vmalloc=340M androidboot.hardware=qcom msm_rtb.filter=0x3b7 ehci-hcd.park=3 androidboot.bootdevice=msm_sdcc.1 buildvariant=userdebug"
deviceinfo_generate_bootimg="true"
deviceinfo_bootimg_qcdt="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"

View File

@ -0,0 +1,11 @@
--- a/arch/arm/mach-msm/smd_init_dt.c
+++ b/arch/arm/mach-msm/smd_init_dt.c
@@ -21,7 +21,7 @@
#include <linux/io.h>
#include <mach/msm_ipc_logging.h>
-#include <smd_private.h>
+#include "smd_private.h"
#define MODULE_NAME "msm_smd"
#define IPC_LOG(level, x...) do { \

View File

@ -0,0 +1,33 @@
source:
https://github.com/ShinySide/HispAsian_Lollipop_G6/commit/b7756b6fc4bb728722b14d2dfdbaf1dc843812e9
* These need to be static to avoid these errors:
drivers/built-in.o: In function `.LANCHOR1':
msm_iommu_sec.c:(.data+0x9298): undefined reference to `kgsl_iommu_sync_lock'
msm_iommu_sec.c:(.data+0x929c): undefined reference to `kgsl_iommu_sync_unlock'
Makefile:877: recipe for target '.tmp_vmlinux1' failed
make: *** [.tmp_vmlinux1] Error 1
Signed-off-by: Chet Kener <Cl3Kener@gmail.com>
--- a/drivers/gpu/msm/kgsl_iommu.c
+++ b/drivers/gpu/msm/kgsl_iommu.c
@@ -1010,7 +1010,7 @@ static int kgsl_iommu_init_sync_lock(struct kgsl_mmu *mmu)
*
* Return - int - number of commands.
*/
-inline unsigned int kgsl_iommu_sync_lock(struct kgsl_mmu *mmu,
+static inline unsigned int kgsl_iommu_sync_lock(struct kgsl_mmu *mmu,
unsigned int *cmds)
{
struct kgsl_device *device = mmu->device;
@@ -1080,7 +1080,7 @@ inline unsigned int kgsl_iommu_sync_lock(struct kgsl_mmu *mmu,
*
* Return - int - number of commands.
*/
-inline unsigned int kgsl_iommu_sync_unlock(struct kgsl_mmu *mmu,
+static inline unsigned int kgsl_iommu_sync_unlock(struct kgsl_mmu *mmu,
unsigned int *cmds)
{
struct kgsl_device *device = mmu->device;

View File

@ -0,0 +1,12 @@
fix for drivers/tspdrv/tspdrv.c:43:20: fatal error: tspdrv.h: No such file or directory
--- a/drivers/tspdrv/tspdrv.c 2017-12-02 09:07:35.000000000 +1300
+++ b/drivers/tspdrv/tspdrv.c 2018-07-26 15:02:55.056381629 +1200
@@ -40,7 +40,7 @@
#include <linux/platform_device.h>
#include <asm/uaccess.h>
#include <asm/atomic.h>
-#include <tspdrv.h>
+#include "tspdrv.h"
#define IMMVIBESPI_MULTIPARAM_SUPPORT

View File

@ -0,0 +1,11 @@
--- a/sound/soc/msm/qdsp6v2/rtac.c
+++ b/sound/soc/msm/qdsp6v2/rtac.c
@@ -26,7 +26,7 @@
#include <sound/q6afe-v2.h>
#include <sound/q6audio-v2.h>
#include <sound/apr_audio-v2.h>
-#include <q6voice.h>
+#include "q6voice.h"
#include "audio_acdb.h"

View File

@ -0,0 +1,99 @@
# Kernel config based on: arch/arm/configs/lineageos_cancro_defconfig
pkgname="linux-xiaomi-cancro"
pkgver=3.4.0
pkgrel=0
pkgdesc="Mi 3 kernel fork"
arch="armhf"
_carch="arm"
_flavor="xiaomi-cancro"
url="https://kernel.org"
license="GPL2"
options="!strip !check !tracedeps"
makedepends="xz perl sed installkernel bash gmp-dev bc linux-headers elfutils-dev dtbtool"
HOSTCC="${CC:-gcc}"
HOSTCC="${HOSTCC#${CROSS_COMPILE}}"
# Source
_repository="android_kernel_xiaomi_cancro"
_commit="b263a8914dcb8f9609be55070c3e40c85020188d"
_config="config-${_flavor}.${arch}"
source="
$pkgname-$_commit.tar.gz::https://github.com/LineageOS/${_repository}/archive/${_commit}.tar.gz
$_config
compiler-gcc6.h
01_smd_private.patch
02_gpu-msm-fix-gcc5-compile.patch
03t_spdrv.patch
tspdrv_2.patch
tspdrv_3.patch
tspdrv_4.patch
tspdrv_5.patch
05_q6voice.patch
"
builddir="$srcdir/${_repository}-${_commit}"
prepare() {
default_prepare
# gcc6 support
cp -v "$srcdir/compiler-gcc6.h" "$builddir/include/linux/"
# Remove -Werror from all makefiles
local i
local makefiles="$(find . -type f -name Makefile)
$(find . -type f -name Kbuild)"
for i in $makefiles; do
sed -i 's/-Werror-/-W/g' "$i"
sed -i 's/-Werror//g' "$i"
done
# Prepare kernel config ('yes ""' for kernels lacking olddefconfig)
cp "$srcdir"/$_config "$builddir"/.config
yes "" | make ARCH="$_carch" HOSTCC="$HOSTCC" oldconfig
}
build() {
unset LDFLAGS
make ARCH="$_carch" CC="${CC:-gcc}" \
KBUILD_BUILD_VERSION="$((pkgrel + 1 ))-postmarketOS"
# Generate master DTB (deviceinfo_bootimg_qcdt)
dtbTool -s 2048 -p "scripts/dtc/" -o "arch/arm/boot/dt.img" "arch/arm/boot/"
}
package() {
# kernel.release
install -D "$builddir/include/config/kernel.release" \
"$pkgdir/usr/share/kernel/$_flavor/kernel.release"
# zImage (find the right one)
cd "$builddir/arch/$_carch/boot"
_target="$pkgdir/boot/vmlinuz-$_flavor"
for _zimg in zImage-dtb Image.gz-dtb *zImage Image; do
[ -e "$_zimg" ] || continue
msg "zImage found: $_zimg"
install -Dm644 "$_zimg" "$_target"
break
done
if ! [ -e "$_target" ]; then
error "Could not find zImage in $PWD!"
return 1
fi
# Master DTB (deviceinfo_bootimg_qcdt)
install -Dm644 "$builddir/arch/arm/boot/dt.img" \
"$pkgdir/boot/dt.img"
}
sha512sums="f24bf599d5a4de3729ceea6a558013a71b550ae772968928cc0825115665a267f65cb16c3b69ed3223e069886c7a1ca16bd0a754cc081accda2ce34fec3b1b58 linux-xiaomi-cancro-b263a8914dcb8f9609be55070c3e40c85020188d.tar.gz
3a87850b94ffc1cf66e974519267d4d69d8ceb96d8bd6a49091e04c844fb7058c340743d561ce9f53febbde7d9967fe8090817f73092647a35998ab08fd416e4 config-xiaomi-cancro.armhf
d80980e9474c82ba0ef1a6903b434d8bd1b092c40367ba543e72d2c119301c8b2d05265740e4104ca1ac5d15f6c4aa49e8776cb44264a9a28dc551e0d1850dcc compiler-gcc6.h
39892cc41e484c51dccc29cadea475aaf99772bafb19231086b614b9eaee520843cd9361c89a6780229961e0ebf4bbf0e115d0e30f8302944b78091fcf7900e7 01_smd_private.patch
7be03a9e78b7ac330a54b1f00509caa0621a95c0c55901878ad757f9dd69cc05ba2c8b5ea987063ae1224f92c4d090d515fa5d369e7755181a4871b0d0f82881 02_gpu-msm-fix-gcc5-compile.patch
b16626bcf66016aee891050cade45127630062339227ce5d20862ab48eba712f92b3ab09e5e0e1bd8e57084fb20dafc4f8a6b3be61823b51136de2ba4c5a9986 03t_spdrv.patch
c1a70619ffb7aec52b8e4b0847800ff7eeae7f1061e61f68030849e0542175c1f83ca5fa12ab78c12e4cce5900467c5c07677d45abff4bc9889d529a7dd20522 tspdrv_2.patch
977e8b6bd17b148fea92952ea92d50c35dd94b3b585af2b30dee000c1092539139b08128494a63b7963bdd6ed4e6a2f44d5faba7e48af41e01440e41f9538b3b tspdrv_3.patch
4b6c12f0591302fe50617ce49eae456befd1e8b9cfcf7ec8a322cbff5f54fbfd85c1b5ea68ad5f84e63450a0972eb07e46bbeb9c5f76c9b42cc2d88e5ef295b7 tspdrv_4.patch
a509f9fbe351fd22d3f036ed3718f9f1e0b24791b7ddb6851bc683fa5197f5856477f6b5552cd6bb6e07df1e355c2a65c228f29e896b158e369ca4c7c7e9e07b tspdrv_5.patch
4e7484eaa142e013c9aee12053d91a65983f7629d2b923566d4431143fa0529988dbc28b01dee21336995090ce8127b2ba79208bf61df359632bfeebae9c6618 05_q6voice.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/tspdrv/tspdrv.c b/drivers/tspdrv/tspdrv.c
index 1a6ca32..69bdc46 100644
--- a/drivers/tspdrv/tspdrv.c
+++ b/drivers/tspdrv/tspdrv.c
@@ -51,7 +51,7 @@ static int g_nTimerPeriodMs = 5; /* 5ms timer by default. This variable could be
static atomic_t g_bRuntimeRecord;
#endif
-#include <ImmVibeSPI.c>
+#include "ImmVibeSPI.c"
#if (defined(VIBE_DEBUG) && defined(VIBE_RECORD)) || defined(VIBE_RUNTIME_RECORD)
#include <tspdrvRecorder.c>
#endif

View File

@ -0,0 +1,19 @@
diff --git a/drivers/tspdrv/tspdrv.c b/drivers/tspdrv/tspdrv.c
index 69bdc46..8101fa9 100644
--- a/drivers/tspdrv/tspdrv.c
+++ b/drivers/tspdrv/tspdrv.c
@@ -92,11 +92,11 @@ static int g_nMajor = 0;
/* Needs to be included after the global variables because they use them */
-#include <tspdrvOutputDataHandler.c>
+#include "tspdrvOutputDataHandler.c"
#ifdef CONFIG_HIGH_RES_TIMERS
- #include <VibeOSKernelLinuxHRTime.c>
+ #include "VibeOSKernelLinuxHRTime.c"
#else
- #include <VibeOSKernelLinuxTime.c>
+ #include "VibeOSKernelLinuxTime.c"
#endif
asmlinkage void _DbgOut(int level, const char *fmt,...)

View File

@ -0,0 +1,12 @@
diff --git a/drivers/tspdrv/tspdrv.c b/drivers/tspdrv/tspdrv.c
index 8101fa9..cc383ba 100644
--- a/drivers/tspdrv/tspdrv.c
+++ b/drivers/tspdrv/tspdrv.c
@@ -40,6 +40,7 @@
#include <linux/platform_device.h>
#include <asm/uaccess.h>
#include <asm/atomic.h>
+#include <asm/bootinfo.h>
#include "tspdrv.h"
#define IMMVIBESPI_MULTIPARAM_SUPPORT

View File

@ -0,0 +1,54 @@
diff --git a/drivers/tspdrv/ImmVibeSPI.c b/drivers/tspdrv/ImmVibeSPI.c
index c28585f..57c0ffb 100644
--- a/drivers/tspdrv/ImmVibeSPI.c
+++ b/drivers/tspdrv/ImmVibeSPI.c
@@ -680,7 +680,6 @@ static void drv2604_write_reg_val(const unsigned char* data, unsigned int size)
if(g_hw_version == 5) {
while (i < size) {
/* From Xiaomi start */
- pr_debug("drv2604 x5 write 0x%02x, 0x%02x", data[i], data[i + 1]);
/* From Xiaomi end */
if(data[i] == 0x02)
i2c_smbus_write_byte_data(g_pTheClient, data[i], 0xFF);
@@ -691,7 +690,6 @@ static void drv2604_write_reg_val(const unsigned char* data, unsigned int size)
} else {
while (i < size) {
/* From Xiaomi start */
- pr_debug("drv2604 write 0x%02x, 0x%02x", data[i], data[i + 1]);
/* From Xiaomi end */
i2c_smbus_write_byte_data(g_pTheClient, data[i], data[i + 1]);
i += 2;
@@ -731,8 +729,6 @@ static unsigned char drv2604_read_reg(unsigned char reg)
msgs[1].len = 1;
res = i2c_transfer(i2c_adap, msgs, 2);
- pr_debug("drv2604 read addr:0x%x reg:0x%x data:0x%x res:%d",
- address, reg, data, res);
return data;
/* From Xiaomi end */
@@ -921,14 +917,12 @@ static void drv2604_pat_work(struct work_struct *work)
if ((time == 0) || (i + 2 >= vibdata.pat_len )) { /* the end */
pwm_disable(vibdata.pwm_dev);
drv2604_change_mode(MODE_STANDBY);
- pr_debug("drv2604 vib len:%d time:%d", vibdata.pat_len, time);
break;
} else {
pwm_duty_enable(vibdata.pwm_dev, 0);
msleep(time);
}
}
- pr_debug("%s: %d vib:%d time:%d value:%u",__func__, i, vibdata.pat[i], time, value);
}
wake_unlock(&vibdata.wklock);
}
@@ -942,9 +936,6 @@ static ssize_t drv2604_write_pattern(struct file *filp, struct kobject *kobj,
#if SUPPORT_WRITE_PAT
mutex_lock(&vibdata.lock);
wake_lock(&vibdata.wklock);
- pr_debug("%s count:%d [%d %d %d %d %d %d %d %d %d ]", __func__,
- count, buffer[0], buffer[1], buffer[2], buffer[3],
- buffer[4], buffer[5], buffer[6], buffer[7], buffer[8]);
vibdata.pat_len = 0;
cancel_work_sync(&vibdata.pat_work);