xiaomi-platina: new device (Xiaomi Mi 8 Lite) (MR 2837)

Both downstream and mainline ports.

https://wiki.postmarketos.org/wiki/Xiaomi_Mi_8_Lite_(xiaomi-platina)
This commit is contained in:
MollySophia 2022-01-11 17:23:35 -08:00 committed by Alexey Min
parent 2c4cbecd54
commit de21973ce3
No known key found for this signature in database
GPG key ID: 0B19D2A65870B448
14 changed files with 6133 additions and 0 deletions

View file

@ -0,0 +1,40 @@
# Reference: <https://postmarketos.org/devicepkg>
pkgname=device-xiaomi-platina
pkgdesc="Xiaomi Mi 8 Lite"
pkgver=0.1
pkgrel=0
url="https://postmarketos.org"
license="MIT"
arch="aarch64"
options="!check !archcheck"
depends="mkbootimg postmarketos-base"
makedepends="devicepkg-dev"
subpackages="
$pkgname-kernel-downstream:kernel_downstream
$pkgname-kernel-mainline:kernel_mainline
"
source="deviceinfo"
build() {
devicepkg_build $startdir $pkgname
}
package() {
devicepkg_package $startdir $pkgname
}
kernel_downstream() {
pkgdesc="LineageOS downstream kernel (recommended)"
depends="linux-xiaomi-platina mesa-dri-swrast msm-fb-refresher"
devicepkg_subpackage_kernel $startdir $pkgname $subpkgname
}
kernel_mainline() {
pkgdesc="For kernel development only (most features aren't working)"
depends="linux-postmarketos-qcom-sdm660"
devicepkg_subpackage_kernel $startdir $pkgname $subpkgname
}
sha512sums="
186c0ffebfd74210a03e5fbcbe910c91362c9f71a6cf7f0db2e143171124b227edaef71c3801ce90d9a90e038f22bdf190941bbdd9c20ee04b4f4b8378ca7331 deviceinfo
"

View file

@ -0,0 +1,41 @@
# 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 8 Lite"
deviceinfo_manufacturer="Xiaomi"
deviceinfo_codename="xiaomi-platina"
deviceinfo_year="2018"
deviceinfo_dtb_mainline="qcom/sdm660-xiaomi-platina"
deviceinfo_append_dtb_mainline="true"
deviceinfo_arch="aarch64"
# Device related
deviceinfo_chassis="handset"
deviceinfo_keyboard="false"
deviceinfo_external_storage="true"
deviceinfo_screen_width="1080"
deviceinfo_screen_height="2280"
# Bootloader related
deviceinfo_flash_method="fastboot"
deviceinfo_flash_fastboot_partition_vbmeta="vbmeta"
deviceinfo_kernel_cmdline_downstream="console=ttyMSM0,115200n8 PMOS_NO_OUTPUT_REDIRECT androidboot.hardware=qcom user_debug=31 msm_rtb.filter=0x37 ehci-hcd.park=3 lpm_levels.sleep_disabled=1 sched_enable_hmp=1 sched_enable_power_aware=1 service_locator.enable=1 swiotlb=1 androidboot.configfs=true androidboot.usbcontroller=a800000.dwc3 loop.max_part=7 usbcore.autosuspend=7 buildvariant=userdebug"
deviceinfo_kernel_cmdline_mainline="PMOS_NO_OUTPUT_REDIRECT"
deviceinfo_generate_bootimg="true"
deviceinfo_bootimg_qcdt="false"
deviceinfo_flash_sparse="true"
deviceinfo_bootimg_mtk_mkimage="false"
deviceinfo_bootimg_dtb_second="false"
deviceinfo_flash_pagesize="4096"
deviceinfo_flash_offset_base="0x00000000"
deviceinfo_flash_offset_kernel="0x00008000"
deviceinfo_flash_offset_ramdisk="0x01000000"
deviceinfo_flash_offset_second="0x00f00000"
deviceinfo_flash_offset_tags="0x00000100"
# USB related
deviceinfo_usb_idVendor="0x2717" # Xiaomi Communications Co., Ltd.
deviceinfo_usb_idProduct="0xff80" # Mi/Redmi series (RNDIS)
deviceinfo_usb_rndis_function_downstream="rndis_bam.rndis"

View file

@ -0,0 +1,198 @@
From 886970824ad3420a7b8cdf1737599bdb796bac88 Mon Sep 17 00:00:00 2001
From: Alexey Min <alexey.min@gmail.com>
Date: Fri, 6 Sep 2019 03:07:16 +0300
Subject: [PATCH 1/6] Use relative includes
Signed-off-by: Alexey Min <alexey.min@gmail.com>
---
drivers/bluetooth/btfm_slim.c | 4 ++--
drivers/bluetooth/btfm_slim_codec.c | 2 +-
drivers/bluetooth/btfm_slim_wcn3990.c | 4 ++--
drivers/bluetooth/btfm_slim_wcn3990.h | 2 +-
drivers/gpu/msm/kgsl_events.c | 2 +-
drivers/input/misc/vl53L0/inc/vl53l0_platform.h | 6 +++---
drivers/input/misc/vl53L0/src/vl53l0_i2c_platform.c | 4 ++--
drivers/input/misc/vl53L0/src/vl53l0_port_i2c.c | 6 +++---
drivers/media/platform/msm/camera_v2/common/cam_smmu_api.c | 2 +-
drivers/media/platform/msm/camera_v2/sensor/msm_sensor.h | 4 ++--
sound/soc/msm/msm8996.c | 2 +-
sound/soc/msm/msm8998.c | 2 +-
12 files changed, 20 insertions(+), 20 deletions(-)
diff --git a/drivers/bluetooth/btfm_slim.c b/drivers/bluetooth/btfm_slim.c
index 0a61186167ba..7cf59ccbe38c 100644
--- a/drivers/bluetooth/btfm_slim.c
+++ b/drivers/bluetooth/btfm_slim.c
@@ -23,8 +23,8 @@
#include <sound/soc.h>
#include <sound/soc-dapm.h>
#include <sound/tlv.h>
-#include <btfm_slim.h>
-#include <btfm_slim_wcn3990.h>
+#include "btfm_slim.h"
+#include "btfm_slim_wcn3990.h"
#include <linux/bluetooth-power.h>
int btfm_slim_write(struct btfmslim *btfmslim,
diff --git a/drivers/bluetooth/btfm_slim_codec.c b/drivers/bluetooth/btfm_slim_codec.c
index 035e8d9fb5fd..5a1b1fef29fd 100644
--- a/drivers/bluetooth/btfm_slim_codec.c
+++ b/drivers/bluetooth/btfm_slim_codec.c
@@ -24,7 +24,7 @@
#include <sound/soc.h>
#include <sound/soc-dapm.h>
#include <sound/tlv.h>
-#include <btfm_slim.h>
+#include "btfm_slim.h"
static int bt_soc_enable_status;
diff --git a/drivers/bluetooth/btfm_slim_wcn3990.c b/drivers/bluetooth/btfm_slim_wcn3990.c
index 7abd5598c47b..7d611f803328 100644
--- a/drivers/bluetooth/btfm_slim_wcn3990.c
+++ b/drivers/bluetooth/btfm_slim_wcn3990.c
@@ -10,8 +10,8 @@
* GNU General Public License for more details.
*/
#include <linux/slimbus/slimbus.h>
-#include <btfm_slim.h>
-#include <btfm_slim_wcn3990.h>
+#include "btfm_slim.h"
+#include "btfm_slim_wcn3990.h"
/* WCN3990 Port assignment */
struct btfmslim_ch wcn3990_rxport[] = {
diff --git a/drivers/bluetooth/btfm_slim_wcn3990.h b/drivers/bluetooth/btfm_slim_wcn3990.h
index b637ac581201..5b75ed6e9cfe 100644
--- a/drivers/bluetooth/btfm_slim_wcn3990.h
+++ b/drivers/bluetooth/btfm_slim_wcn3990.h
@@ -12,7 +12,7 @@
#ifndef BTFM_SLIM_WCN3990_H
#define BTFM_SLIM_WCN3990_H
#ifdef CONFIG_BTFM_SLIM_WCN3990
-#include <btfm_slim.h>
+#include "btfm_slim.h"
/* Registers Address */
#define CHRK_SB_COMP_TEST 0x00000000
diff --git a/drivers/gpu/msm/kgsl_events.c b/drivers/gpu/msm/kgsl_events.c
index 859511baba12..14353267b608 100644
--- a/drivers/gpu/msm/kgsl_events.c
+++ b/drivers/gpu/msm/kgsl_events.c
@@ -15,7 +15,7 @@
#include <linux/list.h>
#include <linux/workqueue.h>
#include <linux/debugfs.h>
-#include <kgsl_device.h>
+#include "kgsl_device.h"
#include "kgsl_debugfs.h"
#include "kgsl_trace.h"
diff --git a/drivers/input/misc/vl53L0/inc/vl53l0_platform.h b/drivers/input/misc/vl53L0/inc/vl53l0_platform.h
index f723a552a7f1..c1c9a6be1286 100644
--- a/drivers/input/misc/vl53L0/inc/vl53l0_platform.h
+++ b/drivers/input/misc/vl53L0/inc/vl53l0_platform.h
@@ -34,9 +34,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "vl53l0_def.h"
#include "vl53l0_platform_log.h"
-#include "stmvl53l0-i2c.h"
-#include "stmvl53l0-cci.h"
-#include "stmvl53l0.h"
+#include "../stmvl53l0-i2c.h"
+#include "../stmvl53l0-cci.h"
+#include "../stmvl53l0.h"
/**
* @file vl53l0_platform.h
diff --git a/drivers/input/misc/vl53L0/src/vl53l0_i2c_platform.c b/drivers/input/misc/vl53L0/src/vl53l0_i2c_platform.c
index e4097e1ccdd5..052e5f75026f 100644
--- a/drivers/input/misc/vl53L0/src/vl53l0_i2c_platform.c
+++ b/drivers/input/misc/vl53L0/src/vl53l0_i2c_platform.c
@@ -22,8 +22,8 @@
#include <linux/i2c.h>
#include <linux/module.h>
#include <linux/delay.h>
-#include "stmvl53l0-i2c.h"
-#include "stmvl53l0-cci.h"
+#include "../stmvl53l0-i2c.h"
+#include "../stmvl53l0-cci.h"
#include "vl53l0_platform.h"
#include "vl53l0_i2c_platform.h"
diff --git a/drivers/input/misc/vl53L0/src/vl53l0_port_i2c.c b/drivers/input/misc/vl53L0/src/vl53l0_port_i2c.c
index 3dc085f60326..29f7aae10f11 100644
--- a/drivers/input/misc/vl53L0/src/vl53l0_port_i2c.c
+++ b/drivers/input/misc/vl53L0/src/vl53l0_port_i2c.c
@@ -7,11 +7,11 @@
#include <linux/i2c.h>
#include <linux/module.h>
-#include "stmvl53l0-i2c.h"
-#include "stmvl53l0-cci.h"
+#include "../stmvl53l0-i2c.h"
+#include "../stmvl53l0-cci.h"
#include "vl53l0_platform.h"
#include "vl53l0_i2c_platform.h"
-#include "stmvl53l0.h"
+#include "../stmvl53l0.h"
#define I2C_M_WR 0x00
#define STATUS_OK 0x00
diff --git a/drivers/media/platform/msm/camera_v2/common/cam_smmu_api.c b/drivers/media/platform/msm/camera_v2/common/cam_smmu_api.c
index 7d9edde62c1b..34df23e71e4a 100644
--- a/drivers/media/platform/msm/camera_v2/common/cam_smmu_api.c
+++ b/drivers/media/platform/msm/camera_v2/common/cam_smmu_api.c
@@ -27,7 +27,7 @@
#include <linux/sizes.h>
#include <soc/qcom/scm.h>
#include <soc/qcom/secure_buffer.h>
-#include <msm_camera_tz_util.h>
+#include "msm_camera_tz_util.h"
#include "cam_smmu_api.h"
#define SCRATCH_ALLOC_START SZ_128K
diff --git a/drivers/media/platform/msm/camera_v2/sensor/msm_sensor.h b/drivers/media/platform/msm/camera_v2/sensor/msm_sensor.h
index 17b6ed988886..2b23032c0214 100644
--- a/drivers/media/platform/msm/camera_v2/sensor/msm_sensor.h
+++ b/drivers/media/platform/msm/camera_v2/sensor/msm_sensor.h
@@ -32,8 +32,8 @@
#include <media/msm_cam_sensor.h>
#include <media/v4l2-subdev.h>
#include <media/v4l2-ioctl.h>
-#include "msm_camera_i2c.h"
-#include "msm_camera_dt_util.h"
+#include "io/msm_camera_i2c.h"
+#include "io/msm_camera_dt_util.h"
#include "msm_sd.h"
#define DEFINE_MSM_MUTEX(mutexname) \
diff --git a/sound/soc/msm/msm8996.c b/sound/soc/msm/msm8996.c
index 49a70a7395ac..aaf191ca5308 100644
--- a/sound/soc/msm/msm8996.c
+++ b/sound/soc/msm/msm8996.c
@@ -31,7 +31,7 @@
#include <sound/q6core.h>
#include <sound/pcm_params.h>
#include <sound/info.h>
-#include <device_event.h>
+#include "device_event.h"
#include "qdsp6v2/msm-pcm-routing-v2.h"
#include "../codecs/wcd9xxx-common.h"
#include "../codecs/wcd9330.h"
diff --git a/sound/soc/msm/msm8998.c b/sound/soc/msm/msm8998.c
index 1c1f65fb3f5c..f7e9d51db8c7 100644
--- a/sound/soc/msm/msm8998.c
+++ b/sound/soc/msm/msm8998.c
@@ -33,7 +33,7 @@
#include <sound/q6core.h>
#include <sound/pcm_params.h>
#include <sound/info.h>
-#include <device_event.h>
+#include "device_event.h"
#include <linux/qdsp6v2/audio_notifier.h>
#include "qdsp6v2/msm-pcm-routing-v2.h"
#include "../codecs/wcd9335.h"
--
2.24.1

View file

@ -0,0 +1,104 @@
From cffdd39e66d384b3bcc71adad5f2749412782d25 Mon Sep 17 00:00:00 2001
From: Alexey Min <alexey.min@gmail.com>
Date: Fri, 6 Sep 2019 16:05:13 +0300
Subject: [PATCH 2/6] Fix TRACE_INCLUDE_PATH paths
Signed-off-by: Alexey Min <alexey.min@gmail.com>
---
drivers/gpu/msm/adreno_trace.h | 2 +-
drivers/gpu/msm/kgsl_trace.h | 2 +-
drivers/net/ethernet/msm/rndis_ipa_trace.h | 2 +-
drivers/platform/msm/ipa/ipa_v2/ipa_trace.h | 2 +-
drivers/platform/msm/ipa/ipa_v3/ipa_trace.h | 2 +-
drivers/soc/qcom/tracer_pkt_private.h | 2 +-
include/trace/events/msm_cam.h | 2 +-
7 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/gpu/msm/adreno_trace.h b/drivers/gpu/msm/adreno_trace.h
index 74c4c4e6e1fa..313f2bb0b117 100644
--- a/drivers/gpu/msm/adreno_trace.h
+++ b/drivers/gpu/msm/adreno_trace.h
@@ -17,7 +17,7 @@
#undef TRACE_SYSTEM
#define TRACE_SYSTEM kgsl
#undef TRACE_INCLUDE_PATH
-#define TRACE_INCLUDE_PATH .
+#define TRACE_INCLUDE_PATH ../../drivers/gpu/msm/
#undef TRACE_INCLUDE_FILE
#define TRACE_INCLUDE_FILE adreno_trace
diff --git a/drivers/gpu/msm/kgsl_trace.h b/drivers/gpu/msm/kgsl_trace.h
index 6438c6e65b97..088534fe7e4c 100644
--- a/drivers/gpu/msm/kgsl_trace.h
+++ b/drivers/gpu/msm/kgsl_trace.h
@@ -17,7 +17,7 @@
#undef TRACE_SYSTEM
#define TRACE_SYSTEM kgsl
#undef TRACE_INCLUDE_PATH
-#define TRACE_INCLUDE_PATH .
+#define TRACE_INCLUDE_PATH ../../drivers/gpu/msm/
#undef TRACE_INCLUDE_FILE
#define TRACE_INCLUDE_FILE kgsl_trace
diff --git a/drivers/net/ethernet/msm/rndis_ipa_trace.h b/drivers/net/ethernet/msm/rndis_ipa_trace.h
index c0fc573799f2..1e8dd9a7f282 100644
--- a/drivers/net/ethernet/msm/rndis_ipa_trace.h
+++ b/drivers/net/ethernet/msm/rndis_ipa_trace.h
@@ -77,5 +77,5 @@ TRACE_EVENT(
/* This part must be outside protection */
#undef TRACE_INCLUDE_PATH
-#define TRACE_INCLUDE_PATH .
+#define TRACE_INCLUDE_PATH ../../drivers/net/ethernet/msm/
#include <trace/define_trace.h>
diff --git a/drivers/platform/msm/ipa/ipa_v2/ipa_trace.h b/drivers/platform/msm/ipa/ipa_v2/ipa_trace.h
index a03a49a33f97..218d3e965943 100644
--- a/drivers/platform/msm/ipa/ipa_v2/ipa_trace.h
+++ b/drivers/platform/msm/ipa/ipa_v2/ipa_trace.h
@@ -148,5 +148,5 @@ TRACE_EVENT(
/* This part must be outside protection */
#undef TRACE_INCLUDE_PATH
-#define TRACE_INCLUDE_PATH .
+#define TRACE_INCLUDE_PATH ../../drivers/platform/msm/ipa/ipa_v2/
#include <trace/define_trace.h>
diff --git a/drivers/platform/msm/ipa/ipa_v3/ipa_trace.h b/drivers/platform/msm/ipa/ipa_v3/ipa_trace.h
index b67899ba894e..9e341ab1d203 100644
--- a/drivers/platform/msm/ipa/ipa_v3/ipa_trace.h
+++ b/drivers/platform/msm/ipa/ipa_v3/ipa_trace.h
@@ -149,5 +149,5 @@ TRACE_EVENT(
/* This part must be outside protection */
#undef TRACE_INCLUDE_PATH
-#define TRACE_INCLUDE_PATH .
+#define TRACE_INCLUDE_PATH ../../drivers/platform/msm/ipa/ipa_v3/
#include <trace/define_trace.h>
diff --git a/drivers/soc/qcom/tracer_pkt_private.h b/drivers/soc/qcom/tracer_pkt_private.h
index fc760e6b68d1..5573aec2fe83 100644
--- a/drivers/soc/qcom/tracer_pkt_private.h
+++ b/drivers/soc/qcom/tracer_pkt_private.h
@@ -15,7 +15,7 @@
#undef TRACE_SYSTEM
#define TRACE_SYSTEM tracer_pkt
#undef TRACE_INCLUDE_PATH
-#define TRACE_INCLUDE_PATH .
+#define TRACE_INCLUDE_PATH ../../drivers/soc/qcom/
#undef TRACE_INCLUDE_FILE
#define TRACE_INCLUDE_FILE tracer_pkt_private
diff --git a/include/trace/events/msm_cam.h b/include/trace/events/msm_cam.h
index b52845407ef0..56f17a701c21 100644
--- a/include/trace/events/msm_cam.h
+++ b/include/trace/events/msm_cam.h
@@ -16,7 +16,7 @@
#if !defined(_TRACE_MSM_VFE_H) || defined(TRACE_HEADER_MULTI_READ)
#define _TRACE_MSM_VFE_H
-#include "msm_isp.h"
+#include "../../drivers/media/platform/msm/camera_v2/isp/msm_isp.h"
#include <linux/types.h>
#include <linux/tracepoint.h>
--
2.24.1

View file

@ -0,0 +1,80 @@
From 92e3310d2db157deacb86ef5db8c8c8d38251312 Mon Sep 17 00:00:00 2001
From: Alexey Min <alexey.min@gmail.com>
Date: Wed, 11 Sep 2019 21:51:40 +0300
Subject: [PATCH 3/6] Add config option to fix bootloader cmdline args
Android bootloader passes some arguments in kernel command
line, that make booting custom OSes harder:
* skip_initramfs
* root=PARTUUID=...
* init=/init
Those parameters override default boot partition to hardcoded,
set init binary to /init, disable booting from initramfs.
If enabled, those parameters will be erased from bootloader's
command line, and custom OS can boot the way it likes.
Signed-off-by: Alexey Min <alexey.min@gmail.com>
---
arch/arm64/Kconfig | 17 +++++++++++++++++
drivers/of/fdt.c | 14 ++++++++++++++
2 files changed, 31 insertions(+)
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index 2829edba6aa5..bd9f05f83c7e 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -1125,6 +1125,23 @@ config CMDLINE_FORCE
command-line options your boot loader passes to the kernel.
endchoice
+config CMDLINE_DROP_DANGEROUS_ANDROID_OPTIONS
+ bool "Drop certain dangerous options from cmdline"
+ default n
+ help
+ Android bootloader passes some arguments in kernel command
+ line, that make booting custom OSes harder:
+
+ * skip_initramfs
+ * root=PARTUUID=...
+ * init=/init
+
+ Those parameters override default boot partition to hardcoded,
+ set init binary to /init, disable booting from initramfs.
+
+ If enabled, those parameters will be erased from bootloader's
+ command line, and custom OS can boot the way it likes.
+
config EFI_STUB
bool
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index ca175710c4c8..fd8257589648 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -1012,6 +1012,20 @@ int __init early_init_dt_scan_chosen(unsigned long node, const char *uname,
pr_debug("Command line is: %s\n", (char*)data);
+#ifdef CONFIG_CMDLINE_DROP_DANGEROUS_ANDROID_OPTIONS
+ pr_err("Replacing dangerous cmdline options...");
+ cmdline = strstr((const char *)data, "skip_initramfs");
+ if (cmdline)
+ *cmdline = '_';
+ cmdline = strstr((const char *)data, "root=");
+ if (cmdline)
+ *cmdline = '_';
+ cmdline = strstr((const char *)data, "init=");
+ if (cmdline)
+ *cmdline = '_';
+ pr_err("Command line now is: %s\n", (char*)data);
+#endif
+
/* break now */
return 1;
}
--
2.24.1

View file

@ -0,0 +1,55 @@
From 49ffc82cc85eb62f9abe5b2fa546dea0744d9829 Mon Sep 17 00:00:00 2001
From: Samuel Dionne-Riel <samuel@dionne-riel.com>
Date: Sun, 29 Sep 2019 14:02:41 -0400
Subject: [PATCH 5/6] Adds and sets BGRA as default
This fixes the issue of Red and Blue channels being mixed up from the
expected.
Signed-off-by: Alexey Min <alexey.min@gmail.com>
---
drivers/video/fbdev/msm/mdss_fb.c | 21 ++++++++++++++++++++-
1 file changed, 20 insertions(+), 1 deletion(-)
diff --git a/drivers/video/fbdev/msm/mdss_fb.c b/drivers/video/fbdev/msm/mdss_fb.c
index 3e632076639d..e4915a4738dc 100644
--- a/drivers/video/fbdev/msm/mdss_fb.c
+++ b/drivers/video/fbdev/msm/mdss_fb.c
@@ -1751,7 +1751,7 @@ static int mdss_fb_probe(struct platform_device *pdev)
mfd->bl_scale = 1024;
mfd->ad_bl_level = 0;
- mfd->fb_imgType = MDP_RGBA_8888;
+ mfd->fb_imgType = MDP_BGRA_8888;
mfd->calib_mode_bl = 0;
mfd->unset_bl_level = U32_MAX;
mfd->bl_extn_level = -1;
@@ -3169,6 +3169,25 @@ static int mdss_fb_register(struct msm_fb_data_type *mfd)
bpp = 4;
break;
+ case MDP_BGRA_8888:
+ fix->type = FB_TYPE_PACKED_PIXELS;
+ fix->xpanstep = 1;
+ fix->ypanstep = 1;
+ var->vmode = FB_VMODE_NONINTERLACED;
+ var->blue.offset = 0;
+ var->green.offset = 8;
+ var->red.offset = 16;
+ var->blue.length = 8;
+ var->green.length = 8;
+ var->red.length = 8;
+ var->blue.msb_right = 0;
+ var->green.msb_right = 0;
+ var->red.msb_right = 0;
+ var->transp.offset = 24;
+ var->transp.length = 8;
+ bpp = 4;
+ break;
+
case MDP_YCRYCB_H2V1:
fix->type = FB_TYPE_INTERLEAVED_PLANES;
fix->xpanstep = 2;
--
2.24.1

View file

@ -0,0 +1,118 @@
From fe5131b250c373d152b7e73895f17846d1f1e6bd Mon Sep 17 00:00:00 2001
From: Ion Agorria <ion@agorria.com>
Date: Thu, 24 Jan 2019 18:52:58 +0100
Subject: [PATCH] mdss: update fb mode at mdss_panelinfo_to_fb_var to fix Xorg
When mdss_panelinfo_to_fb_var is called at
screen unblank it updates the values in fb_info->var,
meanwhile the fb_info->mode and modelist remain with old
values set at registering the fb causing mismatch when
Xorg attempts to set mode.
---
drivers/video/fbdev/msm/mdss_fb.c | 25 ++++++++++++++++------
drivers/video/fbdev/msm/mdss_fb.h | 3 +--
drivers/video/fbdev/msm/mdss_mdp_overlay.c | 2 +-
3 files changed, 20 insertions(+), 10 deletions(-)
diff --git a/drivers/video/fbdev/msm/mdss_fb.c b/drivers/video/fbdev/msm/mdss_fb.c
index 3e632076639d..2d2b37bffa5d 100644
--- a/drivers/video/fbdev/msm/mdss_fb.c
+++ b/drivers/video/fbdev/msm/mdss_fb.c
@@ -2339,7 +2339,7 @@ static void mdss_panel_validate_debugfs_info(struct msm_fb_data_type *mfd)
if (is_panel_split(mfd) && pdata->next)
mdss_fb_validate_split(pdata->panel_info.xres,
pdata->next->panel_info.xres, mfd);
- mdss_panelinfo_to_fb_var(panel_info, var);
+ mdss_panelinfo_to_fb_var(mfd);
if (mdss_fb_send_panel_event(mfd, MDSS_EVENT_CHECK_PARAMS,
panel_info))
pr_err("Failed to send panel event CHECK_PARAMS\n");
@@ -2452,7 +2452,7 @@ static int mdss_fb_blank_unblank(struct msm_fb_data_type *mfd)
* programmed in the controller.
* Update this info in the upstream structs.
*/
- mdss_panelinfo_to_fb_var(panel_info, var);
+ mdss_panelinfo_to_fb_var(mfd);
/* Start the work thread to signal idle time */
if (mfd->idle_time)
@@ -3196,7 +3196,7 @@ static int mdss_fb_register(struct msm_fb_data_type *mfd)
return ret;
}
- mdss_panelinfo_to_fb_var(panel_info, var);
+ mdss_panelinfo_to_fb_var(mfd);
fix->type = panel_info->is_3d_panel;
if (mfd->mdp.fb_stride)
@@ -3900,7 +3900,7 @@ static void mdss_fb_update_resolution(struct msm_fb_data_type *mfd,
}
var->xres_virtual = var->xres;
var->yres_virtual = pinfo->yres * mfd->fb_page;
- mdss_panelinfo_to_fb_var(pinfo, var);
+ mdss_panelinfo_to_fb_var(mfd);
}
int mdss_fb_atomic_commit(struct fb_info *info,
@@ -4149,9 +4149,14 @@ static void mdss_fb_var_to_panelinfo(struct fb_var_screeninfo *var,
pinfo->lcdc.v_polarity = 1;
}
-void mdss_panelinfo_to_fb_var(struct mdss_panel_info *pinfo,
- struct fb_var_screeninfo *var)
+void mdss_panelinfo_to_fb_var(struct msm_fb_data_type *mfd)
{
+ if (!mfd)
+ return -EINVAL;
+
+ struct mdss_panel_info *pinfo = mfd->panel_info;
+ struct fb_info *fbi = mfd->fbi;
+ struct fb_var_screeninfo *var = &fbi->var;
u32 frame_rate;
var->xres = mdss_fb_get_panel_xres(pinfo);
@@ -4185,7 +4190,13 @@ void mdss_panelinfo_to_fb_var(struct mdss_panel_info *pinfo,
if (pinfo->physical_height)
var->height = pinfo->physical_height;
- pr_debug("ScreenInfo: res=%dx%d [%d, %d] [%d, %d]\n",
+ //Hack to update current fbi->mode according to fbi->var when var is updated from panel info
+ if (fbi->mode) {
+ printk("Updating mdss fb mode from fb var\n");
+ fb_var_to_videomode(fbi->mode, var);
+ }
+
+ printk("ScreenInfo: res=%dx%d [%d, %d] [%d, %d]\n",
var->xres, var->yres, var->left_margin,
var->right_margin, var->upper_margin,
var->lower_margin);
diff --git a/drivers/video/fbdev/msm/mdss_fb.h b/drivers/video/fbdev/msm/mdss_fb.h
index c6e8d37d7bc8..bbd17e1c72e2 100644
--- a/drivers/video/fbdev/msm/mdss_fb.h
+++ b/drivers/video/fbdev/msm/mdss_fb.h
@@ -484,8 +484,7 @@ int mdss_fb_async_position_update(struct fb_info *info,
u32 mdss_fb_get_mode_switch(struct msm_fb_data_type *mfd);
void mdss_fb_report_panel_dead(struct msm_fb_data_type *mfd);
-void mdss_panelinfo_to_fb_var(struct mdss_panel_info *pinfo,
- struct fb_var_screeninfo *var);
+void mdss_panelinfo_to_fb_var(struct msm_fb_data_type *mfd);
void mdss_fb_calc_fps(struct msm_fb_data_type *mfd);
void mdss_fb_idle_pc(struct msm_fb_data_type *mfd);
#endif /* MDSS_FB_H */
diff --git a/drivers/video/fbdev/msm/mdss_mdp_overlay.c b/drivers/video/fbdev/msm/mdss_mdp_overlay.c
index 81218319d58b..cee8a8e5e449 100644
--- a/drivers/video/fbdev/msm/mdss_mdp_overlay.c
+++ b/drivers/video/fbdev/msm/mdss_mdp_overlay.c
@@ -3534,7 +3534,7 @@ int mdss_mdp_dfps_update_params(struct msm_fb_data_type *mfd,
* data, so any further call to get the screen
* info has the updated timings.
*/
- mdss_panelinfo_to_fb_var(&pdata->panel_info, var);
+ mdss_panelinfo_to_fb_var(mfd);
MDSS_XLOG(dfps);
mutex_unlock(&mdp5_data->dfps_lock);
--
2.25.1

View file

@ -0,0 +1,29 @@
From 7fc383ecf3a8913dfb89fb7e6a4d2e9376f91fcd Mon Sep 17 00:00:00 2001
From: TAKIZAWA Fumiya <takizawa.fumiya34@gmail.com>
Date: Sat, 9 May 2020 23:58:39 +0900
Subject: [PATCH 1/6] Revert "tty: check before stopping kthread"
This reverts commit d74871d364a32d28c70eb9f521807d8ca6e1968e.
This is a workaround for a crash when CONFIG_VT=y
---
drivers/tty/tty_buffer.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/tty/tty_buffer.c b/drivers/tty/tty_buffer.c
index 92af201f9030..8917b6f87b04 100644
--- a/drivers/tty/tty_buffer.c
+++ b/drivers/tty/tty_buffer.c
@@ -132,8 +132,7 @@ void tty_buffer_free_all(struct tty_port *port)
buf->tail = &buf->sentinel;
atomic_set(&buf->mem_used, 0);
- if (!IS_ERR_OR_NULL(port->worker_thread))
- kthread_stop(port->worker_thread);
+ kthread_stop(port->worker_thread);
}
/**
--
2.26.2

View file

@ -0,0 +1,127 @@
From d2b77ffe10854d1aa3d68c1c346a7d003faa50ca Mon Sep 17 00:00:00 2001
From: TAKIZAWA Fumiya <takizawa.fumiya34@gmail.com>
Date: Sat, 9 May 2020 23:59:08 +0900
Subject: [PATCH 2/6] Revert "tty: move tty_port workqueue to be a kthread"
This reverts commit 6504bb3e934293960287fcf31aba8fd58407d22a.
This is a workaround for a crash when CONFIG_VT=y
---
drivers/tty/tty_buffer.c | 27 +++++++--------------------
include/linux/tty.h | 6 ++----
2 files changed, 9 insertions(+), 24 deletions(-)
diff --git a/drivers/tty/tty_buffer.c b/drivers/tty/tty_buffer.c
index 8917b6f87b04..4706df20191b 100644
--- a/drivers/tty/tty_buffer.c
+++ b/drivers/tty/tty_buffer.c
@@ -71,7 +71,7 @@ void tty_buffer_unlock_exclusive(struct tty_port *port)
atomic_dec(&buf->priority);
mutex_unlock(&buf->lock);
if (restart)
- queue_kthread_work(&port->worker, &buf->work);
+ queue_work(system_unbound_wq, &buf->work);
}
EXPORT_SYMBOL_GPL(tty_buffer_unlock_exclusive);
@@ -132,7 +132,6 @@ void tty_buffer_free_all(struct tty_port *port)
buf->tail = &buf->sentinel;
atomic_set(&buf->mem_used, 0);
- kthread_stop(port->worker_thread);
}
/**
@@ -405,7 +404,7 @@ void tty_schedule_flip(struct tty_port *port)
* flush_to_ldisc() sees buffer data.
*/
smp_store_release(&buf->tail->commit, buf->tail->used);
- queue_kthread_work(&port->worker, &buf->work);
+ queue_work(system_unbound_wq, &buf->work);
}
EXPORT_SYMBOL(tty_schedule_flip);
@@ -473,7 +472,7 @@ receive_buf(struct tty_struct *tty, struct tty_buffer *head, int count)
* 'consumer'
*/
-static void flush_to_ldisc(struct kthread_work *work)
+static void flush_to_ldisc(struct work_struct *work)
{
struct tty_port *port = container_of(work, struct tty_port, buf.work);
struct tty_bufhead *buf = &port->buf;
@@ -563,20 +562,8 @@ void tty_buffer_init(struct tty_port *port)
init_llist_head(&buf->free);
atomic_set(&buf->mem_used, 0);
atomic_set(&buf->priority, 0);
+ INIT_WORK(&buf->work, flush_to_ldisc);
buf->mem_limit = TTYB_DEFAULT_MEM_LIMIT;
- init_kthread_work(&buf->work, flush_to_ldisc);
- init_kthread_worker(&port->worker);
- port->worker_thread = kthread_run(kthread_worker_fn, &port->worker,
- "tty_worker_thread");
- if (IS_ERR(port->worker_thread)) {
- /*
- * Not good, we can't unwind, this tty is going to be really
- * sad...
- */
- pr_err("Unable to start tty_worker_thread\n");
- }
-
-
}
/**
@@ -604,15 +591,15 @@ void tty_buffer_set_lock_subclass(struct tty_port *port)
bool tty_buffer_restart_work(struct tty_port *port)
{
- return queue_kthread_work(&port->worker, &port->buf.work);
+ return queue_work(system_unbound_wq, &port->buf.work);
}
bool tty_buffer_cancel_work(struct tty_port *port)
{
- return kthread_cancel_work_sync(&port->buf.work);
+ return cancel_work_sync(&port->buf.work);
}
void tty_buffer_flush_work(struct tty_port *port)
{
- flush_kthread_work(&port->buf.work);
+ flush_work(&port->buf.work);
}
diff --git a/include/linux/tty.h b/include/linux/tty.h
index 1c1bb90f6819..99165b4e6a7b 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -12,7 +12,7 @@
#include <uapi/linux/tty.h>
#include <linux/rwsem.h>
#include <linux/llist.h>
-#include <linux/kthread.h>
+
/*
* Lock subclasses for tty locks
@@ -82,7 +82,7 @@ static inline char *flag_buf_ptr(struct tty_buffer *b, int ofs)
struct tty_bufhead {
struct tty_buffer *head; /* Queue head */
- struct kthread_work work;
+ struct work_struct work;
struct mutex lock;
atomic_t priority;
struct tty_buffer sentinel;
@@ -240,8 +240,6 @@ struct tty_port {
based drain is needed else
set to size of fifo */
struct kref kref; /* Ref counter */
- struct kthread_worker worker; /* worker thread */
- struct task_struct *worker_thread; /* worker thread */
};
/*
--
2.26.2

View file

@ -0,0 +1,54 @@
From 7a30026cccdf446246b39c3d4bb1fc5c26f2b5bf Mon Sep 17 00:00:00 2001
From: TAKIZAWA Fumiya <takizawa.fumiya34@gmail.com>
Date: Sun, 10 May 2020 00:00:14 +0900
Subject: [PATCH 3/6] Revert "tty: add tty_port_set_policy function"
This reverts commit 115aa3ef849b1c34cdc2f61c5aac3df22a8e1964.
This is a workaround for a crash when CONFIG_VT=y
---
drivers/tty/tty_port.c | 10 ----------
include/linux/tty.h | 2 --
2 files changed, 12 deletions(-)
diff --git a/drivers/tty/tty_port.c b/drivers/tty/tty_port.c
index 9f06fc11bc5f..482f33f20043 100644
--- a/drivers/tty/tty_port.c
+++ b/drivers/tty/tty_port.c
@@ -16,7 +16,6 @@
#include <linux/bitops.h>
#include <linux/delay.h>
#include <linux/module.h>
-#include <uapi/linux/sched.h>
void tty_port_init(struct tty_port *port)
{
@@ -599,12 +598,3 @@ int tty_port_open(struct tty_port *port, struct tty_struct *tty,
}
EXPORT_SYMBOL(tty_port_open);
-
-int tty_port_set_policy(struct tty_port *port, int policy, int sched_priority)
-{
- struct sched_param param = { .sched_priority = sched_priority };
-
- return sched_setscheduler(port->worker_thread, policy, &param);
-}
-EXPORT_SYMBOL_GPL(tty_port_set_policy);
-
diff --git a/include/linux/tty.h b/include/linux/tty.h
index 99165b4e6a7b..812cdd8cff22 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -580,8 +580,6 @@ static inline int tty_port_users(struct tty_port *port)
{
return port->count + port->blocked_open;
}
-extern int tty_port_set_policy(struct tty_port *port, int policy,
- int sched_priority);
extern int tty_register_ldisc(int disc, struct tty_ldisc_ops *new_ldisc);
extern int tty_unregister_ldisc(int disc);
--
2.26.2

View file

@ -0,0 +1,35 @@
From d0d3339500f7b50461492f934b08b953b6a1ba54 Mon Sep 17 00:00:00 2001
From: TAKIZAWA Fumiya <takizawa.fumiya34@gmail.com>
Date: Sun, 10 May 2020 00:00:32 +0900
Subject: [PATCH 4/6] Revert "msm_serial_hs: make the Bluetooth tty thread RT"
This reverts commit f5c9ea68f5c91907e406228710582ef3c23dbe39.
This is a workaround for a crash when CONFIG_VT=y
---
drivers/tty/serial/msm_serial_hs.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/drivers/tty/serial/msm_serial_hs.c b/drivers/tty/serial/msm_serial_hs.c
index c699a662d0a9..1ea54d00e23e 100644
--- a/drivers/tty/serial/msm_serial_hs.c
+++ b/drivers/tty/serial/msm_serial_hs.c
@@ -62,7 +62,6 @@
#include <linux/ipc_logging.h>
#include <asm/irq.h>
#include <linux/kthread.h>
-#include <uapi/linux/sched.h>
#include <linux/msm-sps.h>
#include <linux/platform_data/msm_serial_hs.h>
@@ -3386,7 +3385,6 @@ static void msm_serial_hs_rt_init(struct uart_port *uport)
msm_uport->pm_state = MSM_HS_PM_SUSPENDED;
mutex_unlock(&msm_uport->mtx);
pm_runtime_enable(uport->dev);
- tty_port_set_policy(&uport->state->port, SCHED_FIFO, 1);
}
static int msm_hs_runtime_suspend(struct device *dev)
--
2.26.2

View file

@ -0,0 +1,77 @@
# Reference: <https://postmarketos.org/vendorkernel>
# Kernel config based on: arch/arm64/configs/platina_defconfig
# Maintainer: Molly Sophia <mollysophia379@gmail.com>
pkgname=linux-xiaomi-platina
pkgver=4.4.296
pkgrel=0
pkgdesc="Xiaomi Mi 8 Lite kernel fork"
arch="aarch64"
_carch="arm64"
_flavor="xiaomi-platina"
url="https://kernel.org"
license="GPL-2.0-only"
options="!strip !check !tracedeps pmb:cross-native"
makedepends="perl sed installkernel bash gmp-dev bc linux-headers elfutils-dev devicepkg-dev openssl-dev gcc6"
# Compile with gcc6, kernel does not boot when built with newer versions
if [ "${CC:0:5}" != "gcc6-" ]; then
CC="gcc6-$CC"
HOSTCC="gcc6-gcc"
CROSS_COMPILE="gcc6-$CROSS_COMPILE"
fi
_repourl="https://github.com/LineageOS"
_repository="android_kernel_xiaomi_sdm660"
_commit="82e44f01405d6fcccef53c5d2c95cf2fbbda9075"
_config="config-$_flavor.$arch"
source="
$pkgname-$_commit.tar.gz::$_repourl/$_repository/archive/$_commit.tar.gz
$_config
0001-Use-relative-includes.patch
0002-Fix-TRACE_INCLUDE_PATH-paths.patch
0003-Add-config-option-to-fix-bootloader-cmdline-args.patch
0005-Adds-and-sets-BGRA-as-default.patch
0006-mdss-panel-to-fb-var.patch
0008-Revert-tty-check-before-stopping-kthread.patch
0009-Revert-tty-move-tty_port-workqueue-to-be-a-kthread.patch
0010-Revert-tty-add-tty_port_set_policy-function.patch
0011-Revert-msm_serial_hs-make-the-Bluetooth-tty-thread-R.patch
fix-macro-declare_usb_function.patch
"
builddir="$srcdir/$_repository-$_commit"
prepare() {
default_prepare
. downstreamkernel_prepare
}
build() {
unset LDFLAGS
make ARCH="$_carch" CC="${CC:-gcc}" \
KBUILD_BUILD_VERSION="$((pkgrel + 1 ))-postmarketOS"
}
package() {
downstreamkernel_package "$builddir" "$pkgdir" $_carch $_flavor
# External modules install
make ARCH="$_carch" CC="${CC:-gcc}" \
KBUILD_BUILD_VERSION="$((pkgrel + 1 ))-postmarketOS" \
INSTALL_MOD_PATH="$pkgdir" modules_install
}
sha512sums="
1e7f7ef9629aa72544c76ab941c79a283639dc744e4b88034d6b5787dbbb00073cc65ef846fa8a6c1f70168a595c267b7497d1e9ab4243ef1dd0f06e62ce06ab linux-xiaomi-platina-82e44f01405d6fcccef53c5d2c95cf2fbbda9075.tar.gz
9cd764f6b25de99f044876a076d546cc989ab13a72484c3e54ef187b99760d9e7b2847a05bca3cb3bd274044f374c750ef33781d4d6599792350d0dee2f33e3f config-xiaomi-platina.aarch64
9f1b27e523675ecaafd0ffd884e3e8d0fe9b0bf78b09b5fe044a5d5c9888a86fb0007aa9d90118f0b022a4ace62c5be236097df3bb67a3207a24a766d0907c33 0001-Use-relative-includes.patch
a8713d22404a5e2c0d2add3deb4cb033e972bd1983e10f1557d4de640c1329af50be2bfd92dc3cf76df711a6b4a422b920da76c2d6c4435e3624c85f7d07ae52 0002-Fix-TRACE_INCLUDE_PATH-paths.patch
9ce867c4254b537ef5d2485780c26b72da8a3a8767ba71557f3b48d6c550e0e14c8c3e575b31bf65d2878f08a8a4926e48a1c2f1be534bf80a7a57f58313b0fd 0003-Add-config-option-to-fix-bootloader-cmdline-args.patch
f2a97a9500b6155a11f2341a8fd4b083ceb25a17d656c7975e34b9f3d8bacb495ae687f823db5fd07ddee27b2d95021f193bfadb5274185334255cda12bc85ce 0005-Adds-and-sets-BGRA-as-default.patch
d5b868c64b8ebddcf74cb3aa478f30f0897af1e14e4fc42d977921104a6c568cc0bf36fc8a3b0f538cd3ca2ebf59244fdf23186a903259e5acc14d1c4ef4ccc3 0006-mdss-panel-to-fb-var.patch
1a8cb6ed2cc9b81815160ec990c16385cbe94d71e1607c5968c24a5fa653128fc3e25dfdac861b03faa163d612251814d4c59f4c083258c0d9964c74504c462d 0008-Revert-tty-check-before-stopping-kthread.patch
892a5414647ba609741382bea12de9e2731481fd109bc8febcf77210e1a8d672f22588b5086f27ec32d87b9aea1b0ab1a9e0556f7bd11ddcdfd6ab8b6a1904b0 0009-Revert-tty-move-tty_port-workqueue-to-be-a-kthread.patch
94d8c6a9009fca6484d12cef0698b6e219a09bd82b9ed20eb109467f141514aa9f418988470e658ab340710fb910337645cc772ebe2e59547d329e0c35c9a2a6 0010-Revert-tty-add-tty_port_set_policy-function.patch
89401939fbedfe4719de4706a09702504a92e171806788e597513b7dfca763f4a345895f963b300840fa126c628b43dc3836cf5b3958667b1e6993c1ef0e973e 0011-Revert-msm_serial_hs-make-the-Bluetooth-tty-thread-R.patch
8b3934e3c4115e81ac40a3c8022f3134cd89133f7569557ca857b4fd514078c4898b2ba3427986936d029874903711d04d7757d5a87bcb89137073128e51e8f5 fix-macro-declare_usb_function.patch
"

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,40 @@
--- a/drivers/usb/gadget/function/f_fs.c
+++ b/drivers/usb/gadget/function/f_fs.c
@@ -4295,7 +4295,7 @@
return data;
}
-DECLARE_USB_FUNCTION_INIT(ffs, ffs_alloc_inst, ffs_alloc);
+DECLARE_USB_FUNCTION(ffs, ffs_alloc_inst, ffs_alloc);
static int ffs_init(void)
{
@@ -4303,7 +4303,7 @@
if (IS_ERR_OR_NULL(ffs_ipc_log))
ffs_ipc_log = NULL;
- return 0;
+ usb_function_register(&ffsusb_func);
}
module_init(ffs_init);
@@ -4327,6 +4327,8 @@
ipc_log_context_destroy(ffs_ipc_log);
ffs_ipc_log = NULL;
}
+
+ usb_function_unregister(&ffsusb_func);
}
module_exit(ffs_exit);
--- a/drivers/usb/gadget/function/f_qc_rndis.c
+++ b/drivers/usb/gadget/function/f_qc_rndis.c
@@ -1528,7 +1528,7 @@
return rndis_ipa_params.skip_ep_cfg;
}
-DECLARE_USB_FUNCTION_INIT(rndis_bam, qcrndis_alloc_inst, qcrndis_alloc);
+DECLARE_USB_FUNCTION(rndis_bam, qcrndis_alloc_inst, qcrndis_alloc);
static int __init usb_qcrndis_init(void)
{