xiaomi-riva: Add initial support for Redmi 5A (MR 3595)

[ci:skip-build]: already built successfully in CI
This commit is contained in:
Barnabás Czémán 2022-10-28 21:08:16 +02:00 committed by Dylan Van Assche
parent 1fcbdb1819
commit 7ff30616ef
No known key found for this signature in database
GPG key ID: 8642571587897EA1
9 changed files with 5267 additions and 0 deletions

View file

@ -0,0 +1,42 @@
# Maintainer: Barnabas Czeman <trabarni@gmail.com>
# Reference: <https://postmarketos.org/devicepkg>
pkgname=device-xiaomi-riva
pkgdesc="Xiaomi Redmi 5A"
pkgver=0.1
pkgrel=0
url="https://postmarketos.org"
license="MIT"
arch="aarch64"
options="!check !archcheck"
depends="postmarketos-base linux-xiaomi-riva mkbootimg mdss-fb-init-hack msm-fb-refresher"
makedepends="devicepkg-dev"
source="
deviceinfo
directfbrc
fb.modes
"
subpackages="$pkgname-nonfree-firmware:nonfree_firmware"
build() {
devicepkg_build $startdir $pkgname
}
package() {
devicepkg_package $startdir $pkgname
install -Dm644 "$srcdir"/fb.modes "$pkgdir"/etc/fb.modes
install -Dm644 "$srcdir"/directfbrc "$pkgdir"/etc/directfbrc
}
nonfree_firmware() {
pkgdesc="Wifi firmware"
depends="firmware-xiaomi-riva wcnss-wlan"
mkdir "$subpkgdir"
}
sha512sums="
1db2d85434b41671c204383f90fe6d6dd1e3c7e874f1bb8d5ba6c7cfc61f91866f641bfa8a8d537ae20b7c8cfdbe4975fe98f40f512c50dc7c0b6c767c2dec43 deviceinfo
3db3ec596e159be926ea2b5b2496c18e9bc7be24a64a232a56c89a0c9ee710aa2efb2b6fa9fc08efa34759e8242e6c629d08a4ce688ec8aa125830717c191515 directfbrc
024d11176fbd19f98746317b098d0b54236166aa66155cc68ad75a7ce8335999a1a14ed2efc93f9ac4e05fbc787d8bad793efccf813db81aa48fffd1850ec24e fb.modes
"

View file

@ -0,0 +1,30 @@
# 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 Redmi 5A"
deviceinfo_manufacturer="Xiaomi"
deviceinfo_codename="xiaomi-riva"
deviceinfo_year="2017"
deviceinfo_arch="aarch64"
# Device related
deviceinfo_chassis="handset"
deviceinfo_keyboard="false"
deviceinfo_external_storage="true"
deviceinfo_screen_width="720"
deviceinfo_screen_height="1280"
deviceinfo_swap_size_recommended="1024"
# Bootloader related
deviceinfo_flash_method="fastboot"
deviceinfo_kernel_cmdline="androidboot.hardware=qcom msm_rtb.filter=0x237 ehci-hcd.park=3 lpm_levels.sleep_disabled=1 androidboot.usbconfigfs=false androidboot.bootdevice=7824900.sdhci earlycon=msm_hsl_uart,0x78B0000 androidboot.selinux=permissive loop.max_part=7 buildvariant=userdebug"
deviceinfo_generate_bootimg="true"
deviceinfo_bootimg_qcdt="false"
deviceinfo_bootimg_dtb_second="false"
deviceinfo_flash_offset_base="0x80000000"
deviceinfo_flash_offset_kernel="0x00008000"
deviceinfo_flash_offset_ramdisk="0x01000000"
deviceinfo_flash_offset_second="0x00f00000"
deviceinfo_flash_offset_tags="0x00000100"
deviceinfo_flash_pagesize="2048"

View file

@ -0,0 +1 @@
pixelformat=ARGB

View file

@ -0,0 +1,8 @@
mode "720x1280-60"
# D: 98.542 MHz, H: 80.706 kHz, V: 60.004 Hz
geometry 720 1280 720 1280 16
timings 10148 241 240 28 35 20 2
accel false
rgba 8/0,8/8,8/16,8/24
endmode

View file

@ -0,0 +1,35 @@
# Maintainer: Barnabas Czeman <trabarni@gmail.com>
pkgname=firmware-xiaomi-riva
pkgver=0.1
pkgrel=0
_commit="55441372abe4072f0f174a9614dcbe4b0d4bfcab"
pkgdesc="Firmware files for Xiaomi Redmi 5A"
url="https://postmarketos.org"
arch="aarch64"
license="proprietary"
options="!strip !check !archcheck !spdx pmb:cross-native !tracedeps"
_files="wcnss.b00 wcnss.b01 wcnss.b02 wcnss.b04 wcnss.b06
wcnss.b09 wcnss.b10 wcnss.b11 wcnss.b12 wcnss.mdt"
_files_prima="WCNSS_qcom_cfg.ini WCNSS_qcom_wlan_nv.bin WCNSS_wlan_dictionary.dat"
source="$pkgname-$_commit.tar.gz::https://gitlab.com/ALTracer/vendor_xiaomi_rolex/-/archive/$_commit/vendor_xiaomi_rolex-$_commit.tar.gz"
builddir="$srcdir/vendor_xiaomi_rolex-$_commit"
package() {
# /lib/firmware/postmarketos
for _i in $_files; do
install -D -m644 "$_i" \
"$pkgdir"/lib/firmware/postmarketos/"$_i"
done
# /lib/firmware/postmarketos/wlan/prima
for _i in $_files_prima; do
install -D -m644 wlan/prima/"$_i" \
"$pkgdir"/lib/firmware/postmarketos/wlan/prima/"$_i"
done
}
sha512sums="
91493ed18d462b1aa72df72f06d975a68ef2133b2f6f33971452a77477e5045b8dc9d3842779449407681e49362cdc1a700dcaf3b246f5e5b48450a6edc3cbde firmware-xiaomi-riva-55441372abe4072f0f174a9614dcbe4b0d4bfcab.tar.gz
"

View file

@ -0,0 +1,40 @@
diff --git a/drivers/video/fbdev/msm/mdss_fb.c b/drivers/video/fbdev/msm/mdss_fb.c
index 66c3661f7ed9..b72c82c0104a 100644
--- a/drivers/video/fbdev/msm/mdss_fb.c
+++ b/drivers/video/fbdev/msm/mdss_fb.c
@@ -1311,7 +1311,7 @@ static int mdss_fb_probe(struct platform_device *pdev)
mfd->bl_scale = 1024;
mfd->bl_min_lvl = 30;
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;
@@ -2729,7 +2729,25 @@ static int mdss_fb_register(struct msm_fb_data_type *mfd)
var->transp.length = 8;
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;

View file

@ -0,0 +1,50 @@
# Maintainer: Barnabas Czeman <trabarni@gmail.com>
# Reference: <https://postmarketos.org/vendorkernel>
# Kernel config based on: arch/arm64/configs/riva_defconfig
pkgname=linux-xiaomi-riva
pkgver=4.9.241
pkgrel=0
pkgdesc="Xiaomi Redmi 5A kernel fork"
arch="aarch64"
_carch="arm64"
_flavor="xiaomi-riva"
url="https://kernel.org"
license="GPL-2.0-only"
options="!strip !check !tracedeps pmb:cross-native"
makedepends="bash bc bison devicepkg-dev flex openssl-dev perl"
# Source
_repository="android_kernel_xiaomi_msm8917"
_commit="e452b3a9c3b97522b1b58e41ea3e12059b5ee92e"
_config="config-$_flavor.$arch"
source="
$pkgname-$_commit.tar.gz::https://github.com/SunnyRaj84348/$_repository/archive/$_commit.tar.gz
$_config
fix-xorg-mdss-update-fb-info.patch
99_framebuffer.patch
"
builddir="$srcdir/$_repository-$_commit"
_outdir="out"
prepare() {
default_prepare
. downstreamkernel_prepare
}
build() {
unset LDFLAGS
make O="$_outdir" ARCH="$_carch" CC="${CC:-gcc}" \
KBUILD_BUILD_VERSION="$((pkgrel + 1 ))-postmarketOS"
}
package() {
downstreamkernel_package "$builddir" "$pkgdir" "$_carch" "$_flavor" "$_outdir"
}
sha512sums="
8cb6764ccbb24a2216e66527487ae11047b0b192e6f8e15075ea52320061cb108346eb6328fbbd65e1ea3b0c8c1efca581827ee7bbf225f88579f3d2cdef5e45 linux-xiaomi-riva-e452b3a9c3b97522b1b58e41ea3e12059b5ee92e.tar.gz
1056c26b9a8c93799b689bdf04b9c13953d0c7d97cb61125642067af2cb36f8e33cfa2c9283d5c08d38926a14272dfa9b1fc1fec4ad2630503687c488f2c8706 config-xiaomi-riva.aarch64
e11a1ca524a05a5fe8b845937dbc57ee38c52e0a1a979d8e7be0ac53df22f84dfb424205ee7f541acfca3daba3e9f5d49bb4b9e9bb482eb354de14eb28bd0094 fix-xorg-mdss-update-fb-info.patch
741a46c6679172639568df96614b12a543563895ddee79051d88d28742b26d9c725f1d03dc208152c46e87b8b58240a3e206877da9a6a72035095e0f43458a72 99_framebuffer.patch
"

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,107 @@
diff --git a/drivers/video/fbdev/msm/mdss_fb.c b/drivers/video/fbdev/msm/mdss_fb.c
index 66c3661f7ed9..e4f98d88c7d9 100644
--- a/drivers/video/fbdev/msm/mdss_fb.c
+++ b/drivers/video/fbdev/msm/mdss_fb.c
@@ -1881,7 +1881,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");
@@ -2017,7 +2017,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)
@@ -2757,7 +2757,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)
@@ -3461,7 +3461,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,
@@ -3695,9 +3695,15 @@ static void mdss_fb_var_to_panelinfo(struct fb_var_screeninfo *var,
pinfo->mipi.dsi_pclk_rate = pinfo->clk_rate;
}
-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);
@@ -3732,10 +3738,17 @@ 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",
- var->xres, var->yres, var->left_margin,
- var->right_margin, var->upper_margin,
- var->lower_margin);
+ //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 4b39f9edef0c..4a0d13f2f079 100644
--- a/drivers/video/fbdev/msm/mdss_fb.h
+++ b/drivers/video/fbdev/msm/mdss_fb.h
@@ -476,8 +476,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 b70db4faac09..951c7c7497d5 100644
--- a/drivers/video/fbdev/msm/mdss_mdp_overlay.c
+++ b/drivers/video/fbdev/msm/mdss_mdp_overlay.c
@@ -3846,7 +3846,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);