samsung-m20lte: new device

Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/8603>
This commit is contained in:
DiegoStocco 2026-05-02 20:06:05 +02:00 committed by The Friendly Meow (merge) Bot
parent 20bfba5913
commit a76125ccb2
No known key found for this signature in database
11 changed files with 5729 additions and 0 deletions

View file

@ -0,0 +1,31 @@
# Reference: <https://postmarketos.org/devicepkg>
maintainer="Diego Stocco <diegostocco.2008@gmail.com>"
pkgname=device-samsung-m20lte
pkgdesc="Samsung Galaxy M20"
pkgver=1
pkgrel=0
url="https://postmarketos.org"
license="MIT"
arch="aarch64"
depends="
android-tools-mkbootimg
dtbtool-exynos
firmware-samsung-m20lte
linux-samsung-m20lte
postmarketos-base
"
makedepends="devicepkg-dev"
source="deviceinfo"
options="!archcheck !check"
build() {
devicepkg_build $startdir $pkgname
}
package() {
devicepkg_package $startdir $pkgname
}
sha512sums="
4fb6e7c7a32bd3e595e2261d89e8b7252310ed96ee28f8e942bb303c21af11b8da9db200df930c076e7dc06b22d6844e2919752b752da41b721a3f4ebf6f1354 deviceinfo
"

View file

@ -0,0 +1,34 @@
# Reference: <https://postmarketos.org/deviceinfo>
# Please use double quotes only. You can source this file in shell
# scripts.
deviceinfo_format_version="0"
deviceinfo_name="Samsung Galaxy M20"
deviceinfo_manufacturer="Samsung"
deviceinfo_codename="samsung-m20lte"
deviceinfo_year="2019"
deviceinfo_dtb="exynos/exynos7904-m20lte_swa_open_04"
deviceinfo_arch="aarch64"
# Device related
deviceinfo_chassis="handset"
deviceinfo_external_storage="true"
# Bootloader related
deviceinfo_flash_method="heimdall-bootimg"
deviceinfo_generate_bootimg="true"
deviceinfo_flash_pagesize="2048"
deviceinfo_bootimg_qcdt="true"
deviceinfo_bootimg_qcdt_type="exynos"
deviceinfo_flash_offset_kernel="0x00008000"
deviceinfo_flash_offset_ramdisk="0x01000000"
deviceinfo_flash_offset_second="0xf0000000"
deviceinfo_flash_offset_tags="0x00000100"
deviceinfo_flash_heimdall_partition_kernel="BOOT"
deviceinfo_flash_heimdall_partition_rootfs="USERDATA"
# Fix for small boot partition
deviceinfo_create_initfs_extra="true"
# Try to solve "ERROR: Failed to confirm end of file transfer sequence" in heimdall
deviceinfo_flash_sparse="true"

View file

@ -0,0 +1,32 @@
maintainer="Diego Stocco <diegostocco.2008@gmail.com>"
pkgname=firmware-samsung-m20lte
pkgver=1
pkgrel=0
_commit="340fa274fefee4dc4ef9973fc0837ec557ac9736"
pkgdesc="Firmware for the Samsung Galaxy M20"
url="https://github.com/DiegoStocco/vendor_samsung-m20lte"
arch="aarch64"
license="proprietary"
options="!archcheck !check !spdx !strip !tracedeps pmb:cross-native"
builddir="$srcdir/vendor_samsung-m20lte-$_commit/vendor/etc/wifi/"
# Source
source="$pkgname-$_commit.tar.gz::https://github.com/DiegoStocco/vendor_samsung-m20lte/archive/$_commit.tar.gz"
package() {
#WIFI FIRMWARE
install -Dm644 mx \
-t "$pkgdir"/usr/lib/firmware/postmarketos/mx140/
install -Dm644 mx140.bin \
-t "$pkgdir"/usr/lib/firmware/postmarketos/mx140/
install -Dm644 mx140_bt.hcf \
-t "$pkgdir"/usr/lib/firmware/postmarketos/mx140/
install -Dm644 mx140_wlan.hcf \
-t "$pkgdir"/usr/lib/firmware/postmarketos/mx140/
install -Dm644 mx140_wlan_t.hcf \
-t "$pkgdir"/usr/lib/firmware/postmarketos/mx140/
}
sha512sums="
615f75855936a71e9b9761f7a51a716da35e3cc7ce584b7961895f3c597fbfc83ecfc41449131d8cdb40acb0b888f97cf3900c7a0245bb9e7069318c84c2e6db firmware-samsung-m20lte-340fa274fefee4dc4ef9973fc0837ec557ac9736.tar.gz
"

View file

@ -0,0 +1,84 @@
# Reference: <https://postmarketos.org/vendorkernel>
# Kernel config based on: arch/arm64/configs/m20lte_defconfig
maintainer="Diego Stocco <diegostocco.2008@gmail.com>"
pkgname=linux-samsung-m20lte
pkgver=4.4.177
pkgrel=0
_commit="339a04eabab9310ad9f6039831f6834d7f9d3c2b"
pkgdesc="Samsung Galaxy M20 kernel fork"
arch="aarch64"
_carch="arm64"
_flavor="samsung-m20lte"
url="https://kernel.org"
license="GPL-2.0-only"
makedepends="
bash
bc
bison
devicepkg-dev
dtbtool-exynos
findutils
flex
openssl-dev
perl
"
_config="config-$_flavor.$arch"
source="
$pkgname-$_commit.tar.gz::https://github.com/LineageOS/android_kernel_samsung_universal7904/archive/$_commit.tar.gz
$_config
fix-check-lxdialog.patch
fix-scsc-kconfig.patch
fix-decon.patch
fix-multiple-modules.patch
fix-spinlock.patch
fix-usblog-proc-notify-not-included.patch
"
options="!check !strip !tracedeps pmb:cross-native"
builddir="$srcdir/android_kernel_samsung_universal7904-$_commit"
_outdir="out"
prepare() {
default_prepare
. downstreamkernel_prepare
}
build() {
unset LDFLAGS
make O="$_outdir" ARCH="$_carch" CROSS_COMPILE= CC="${CC:-gcc}" \
KBUILD_BUILD_VERSION="$((pkgrel + 1 ))-postmarketOS"
# deviceinfo_bootimg_qcdt
dtbTool-exynos -o "$_outdir/arch/$_carch/boot"/dt.img \
$(find "$_outdir/arch/$_carch/boot/dts/" -name *m20lte*.dtb)
}
package() {
downstreamkernel_package "$builddir" "$pkgdir" "$_carch" \
"$_flavor" "$_outdir"
install -Dm644 "$_outdir/arch/$_carch/boot"/dt.img \
-t "$pkgdir"/boot/
make modules_install \
O="$_outdir" \
ARCH="$_carch" \
INSTALL_PATH="$pkgdir"/boot/ \
INSTALL_MOD_PATH="$pkgdir"/usr \
INSTALL_MOD_STRIP=1
mkdir "$pkgdir"/boot/dtbs
mkdir "$pkgdir"/boot/dtbs/exynos
install -Dm644 $(find "$_outdir/arch/$_carch/boot/dts/" -name *m20lte*.dtb) \
"$pkgdir"/boot/dtbs/exynos/$(basename $(find "$_outdir/arch/$_carch/boot/dts/" -name *m20lte*.dtb))
}
sha512sums="
663f7cff6dee546104a34f38ba27f89211ef40514e4ebdf63d4bc60a523f31d831e349060b70cc407498a33044ced3d0e806b8325c07f7b5a3b829d610bef490 linux-samsung-m20lte-339a04eabab9310ad9f6039831f6834d7f9d3c2b.tar.gz
93c5aa1ad25a32a11aaba114ad16dc4a31595b8466594c3c76ae362db590a8b0c0f5d0a160b242fe5275052e9e9b26fa1367959441065e7127c325a5dc19367a config-samsung-m20lte.aarch64
182be3c596b9cc267ac108d7cf03fc8c328ccc6b36770800e4dcedea8d1bb65e3f5eacf590c2948f58b1418cc60a1670ba77dde8c259e428d158c31b6e1dbaf5 fix-check-lxdialog.patch
2038a0e7b3a076e83e4a8fa2e5d35650c52f947985ca58310aaf94211756eef1635bb3c8e047a77ecc0a69de55f49be37081bfd570e49031b2397a9d6de87285 fix-scsc-kconfig.patch
88a5ef18d9eb31e6d80317925907651229529cd41f8b181b61c14ff56b340341c8ff5c95ab0dd9562b9575d4e206623e7dc039a9eb6b34c455165878df63cd86 fix-decon.patch
707d7fe4cde4932f6cf8fc1c33c0b5ab3fbb522a6b8f456ae42d3070783a7d0984b645e4850db618c03d87d559951678fe078c321b07ad41ef25543f3895557d fix-multiple-modules.patch
47b313f27b4d0e04f9635e887ad3cfe7d741b43b5ade2fd0149a585e0ade77162e8507c71df369af13cb6bd9f0176b67ba723d44e437c530c7345ad32d195dca fix-spinlock.patch
94cff37f62cc61aa5c6b97f2497b03bb4c0bf9f112f7ce950cdc7ef8345ebb802a16e40a5fbea6830d17c3dce50db1402837344d2a2a30f77521934343607837 fix-usblog-proc-notify-not-included.patch
"

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1 @@
../../.shared-patches/linux/fix-check-lxdialog.patch

View file

@ -0,0 +1,157 @@
Subject: [PATCH] decon fix
---
Index: drivers/video/fbdev/exynos/dpu_7885/decon_core.c
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/drivers/video/fbdev/exynos/dpu_7885/decon_core.c b/drivers/video/fbdev/exynos/dpu_7885/decon_core.c
--- a/drivers/video/fbdev/exynos/dpu_7885/decon_core.c (revision 5eeafe2bfcb93847b403fd92bd92f9d0a9f6341d)
+++ b/drivers/video/fbdev/exynos/dpu_7885/decon_core.c (date 1644158930000)
@@ -703,11 +703,15 @@
return ret;
}
+int decon_set_vsync_int(struct fb_info *info, bool active);
+extern int needs_pan;
+
static int decon_blank(int blank_mode, struct fb_info *info)
{
struct decon_win *win = info->par;
struct decon_device *decon = win->decon;
int ret = 0;
+ struct fb_info *fb_info;
decon_info("%s + blank_mode: %d, decon-%d %s mode: %dtype (0: DSI, 1: eDP, 2:DP, 3: WB)\n",
__func__, blank_mode,
@@ -741,6 +745,10 @@
goto blank_exit;
}
atomic_set(&decon->ffu_flag, 2);
+
+ needs_pan = true;
+ fb_info = decon->win[decon->dt.dft_win]->fbinfo;
+ decon_set_vsync_int(fb_info, true);
break;
case FB_BLANK_VSYNC_SUSPEND:
case FB_BLANK_HSYNC_SUSPEND:
@@ -2152,18 +2160,6 @@
return ret;
}
-static ssize_t decon_fb_read(struct fb_info *info, char __user *buf,
- size_t count, loff_t *ppos)
-{
- return 0;
-}
-
-static ssize_t decon_fb_write(struct fb_info *info, const char __user *buf,
- size_t count, loff_t *ppos)
-{
- return 0;
-}
-
int decon_release(struct fb_info *info, int user)
{
struct decon_win *win = info->par;
@@ -2217,12 +2213,12 @@
.fb_blank = decon_blank,
.fb_setcolreg = decon_setcolreg,
.fb_fillrect = cfb_fillrect,
+ .fb_copyarea = cfb_copyarea,
+ .fb_imageblit = cfb_imageblit,
#ifdef CONFIG_COMPAT
.fb_compat_ioctl = decon_compat_ioctl,
#endif
.fb_ioctl = decon_ioctl,
- .fb_read = decon_fb_read,
- .fb_write = decon_fb_write,
.fb_pan_display = decon_pan_display,
.fb_mmap = decon_mmap,
.fb_release = decon_release,
@@ -2532,6 +2528,7 @@
}
fbinfo->fix.type = FB_TYPE_PACKED_PIXELS;
+ fbinfo->fix.visual = FB_VISUAL_TRUECOLOR,
fbinfo->fix.accel = FB_ACCEL_NONE;
fbinfo->var.activate = FB_ACTIVATE_NOW;
fbinfo->var.vmode = FB_VMODE_NONINTERLACED;
@@ -2846,7 +2843,7 @@
decon->bts.ops->bts_update_qos_disp(decon, decon->dt.disp_freq);
decon_to_init_param(decon, &p);
-#if !defined(BRINGUP_DECON_BIST)
+#if 0// !defined(BRINGUP_DECON_BIST)
if (decon_reg_init(decon->id, decon->dt.out_idx[0], &p) < 0)
goto decon_init_done;
#else
@@ -2879,7 +2876,7 @@
set_bit(decon->dt.dft_idma, &decon->prev_used_dpp);
memset(&config, 0, sizeof(struct decon_win_config));
config.dpp_parm.addr[0] = fbinfo->fix.smem_start;
- config.format = DECON_PIXEL_FORMAT_BGRA_8888;
+ config.format = DECON_PIXEL_FORMAT_ARGB_8888;
config.src.w = fbinfo->var.xres;
config.src.h = fbinfo->var.yres;
config.src.f_w = fbinfo->var.xres;
@@ -2922,10 +2919,11 @@
call_panel_ops(dsim, displayon, dsim);
decon_reg_start(decon->id, &psr);
decon_wait_for_vsync(decon, VSYNC_TIMEOUT_MSEC);
+ decon_set_vsync_int(fbinfo, true);
if (decon_reg_wait_update_done_and_mask(decon->id, &psr,
SHADOW_UPDATE_TIMEOUT) < 0)
decon_err("%s: wait_for_update_timeout\n", __func__);
-#if !defined(BRINGUP_DECON_BIST)
+#if 0 //!defined(BRINGUP_DECON_BIST)
decon_init_done:
#endif
decon->state = DECON_STATE_INIT;
Index: drivers/video/fbdev/exynos/dpu_7885/decon_dsi.c
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/drivers/video/fbdev/exynos/dpu_7885/decon_dsi.c b/drivers/video/fbdev/exynos/dpu_7885/decon_dsi.c
--- a/drivers/video/fbdev/exynos/dpu_7885/decon_dsi.c (revision 5eeafe2bfcb93847b403fd92bd92f9d0a9f6341d)
+++ b/drivers/video/fbdev/exynos/dpu_7885/decon_dsi.c (date 1644158930000)
@@ -353,6 +353,8 @@
}
static DEVICE_ATTR(vsync, S_IRUGO, decon_show_vsync, NULL);
+int needs_pan = false;
+
static int decon_vsync_thread(void *data)
{
struct decon_device *decon = data;
@@ -363,6 +365,20 @@
!ktime_equal(timestamp, decon->vsync.timestamp) &&
decon->vsync.active);
+ struct decon_mode_info psr;
+
+ if (needs_pan) {
+ //Verrrry hacky and bad... plox gib better solution
+ struct fb_info *fb_info = decon->win[decon->dt.dft_win]->fbinfo;
+ struct fb_var_screeninfo *var = &fb_info->var;
+ usleep_range(200000, 201000);
+ decon_pan_display(var, fb_info);
+ needs_pan = false;
+ }
+
+ decon_to_psr_info(decon, &psr);
+ decon_reg_start(decon->id, &psr);
+
if (!ret)
sysfs_notify(&decon->dev->kobj, NULL, "vsync");
}
@@ -692,7 +708,7 @@
break;
case 24:
case 32:
- config.format = DECON_PIXEL_FORMAT_ABGR_8888;
+ config.format = DECON_PIXEL_FORMAT_ARGB_8888;
shift = 4;
break;
default:

View file

@ -0,0 +1,29 @@
diff --git a/drivers/usb/gadget/function/f_acm.c b/drivers/usb/gadget/function/f_acm.c
index 771a3ad5..109b819f 100755
--- a/drivers/usb/gadget/function/f_acm.c
+++ b/drivers/usb/gadget/function/f_acm.c
@@ -874,8 +874,8 @@ static void __exit acm_exit(void)
{
return usb_function_unregister(&acmusb_func);
}
-module_init(acm_init);
-module_exit(acm_exit);
+// module_init(acm_init);
+// module_exit(acm_exit);
#endif
MODULE_LICENSE("GPL");
diff --git a/drivers/usb/gadget/function/f_uts.c b/drivers/usb/gadget/function/f_uts.c
index 27b6eb99..44d5c94a 100755
--- a/drivers/usb/gadget/function/f_uts.c
+++ b/drivers/usb/gadget/function/f_uts.c
@@ -868,7 +868,7 @@ static void __exit uts_exit(void)
{
return usb_function_unregister(&utsusb_func);
}
-module_init(uts_init);
-module_exit(uts_exit);
+// module_init(uts_init);
+// module_exit(uts_exit);
#endif
MODULE_LICENSE("GPL");

View file

@ -0,0 +1,13 @@
diff --git a/drivers/misc/samsung/scsc/Kconfig b/drivers/misc/samsung/scsc/Kconfig
index 59386756..85839432 100755
--- a/drivers/misc/samsung/scsc/Kconfig
+++ b/drivers/misc/samsung/scsc/Kconfig
@@ -13,7 +13,7 @@ config SCSC_CORE_FW_LOCATION
Select the FW location, when CONFIG_SCSC_CORE_FW_LOCATION_AUTO=n
config SCSC_CORE_FW_LOCATION_AUTO
- string "SCSC FW location auto select"
+ bool "SCSC FW location auto select"
default y
---help---
Select the FW location (Android N/O) automatically

View file

@ -0,0 +1,20 @@
diff --git a/drivers/usb/gadget/function/f_hid.c b/drivers/usb/gadget/function/f_hid.c
index 49effc34..8d559239 100755
--- a/drivers/usb/gadget/function/f_hid.c
+++ b/drivers/usb/gadget/function/f_hid.c
@@ -508,13 +508,13 @@ static void hidg_disable(struct usb_function *f)
usb_ep_disable(hidg->in_ep);
usb_ep_disable(hidg->out_ep);
- spin_lock_irqsave(&hidg->read_spinlock, flags);
+ spin_lock_irqsave(&hidg->spinlock, flags);
list_for_each_entry_safe(list, next, &hidg->completed_out_req, list) {
free_ep_req(hidg->out_ep, list->req);
list_del(&list->list);
kfree(list);
}
- spin_unlock_irqrestore(&hidg->read_spinlock, flags);
+ spin_unlock_irqrestore(&hidg->spinlock, flags);
}
static int hidg_set_alt(struct usb_function *f, unsigned intf, unsigned alt)

View file

@ -0,0 +1,13 @@
diff --git a/drivers/usb/gadget/configfs.c b/drivers/usb/gadget/configfs.c
index 83cbae2d..5f376388 100755
--- a/drivers/usb/gadget/configfs.c
+++ b/drivers/usb/gadget/configfs.c
@@ -10,6 +10,8 @@
#include "u_os_desc.h"
#include <linux/soc/samsung/exynos-soc.h>
+#include <linux/usblog_proc_notify.h>
+
#ifdef CONFIG_USB_CONFIGFS_UEVENT
#include <linux/platform_device.h>
#include <linux/kdev_t.h>