samsung-s3ve3g: new device (Samsung Galaxy S III Neo) (MR 1278)

* change arch to armv7
 * working framebuffer
 * disable v4l udev rules
This commit is contained in:
Snejp 2020-05-31 14:21:35 +02:00 committed by Alexey Min
parent 768ae7c1ee
commit 71ed65d2db
No known key found for this signature in database
GPG key ID: EBF5ECFFFEE34DED
14 changed files with 4752 additions and 0 deletions

View file

@ -0,0 +1,31 @@
# Reference: <https://postmarketos.org/devicepkg>
pkgname=device-samsung-s3ve3g
pkgdesc="Samsung Galaxy S III Neo"
pkgver=0.1
pkgrel=0
url="https://postmarketos.org"
license="MIT"
arch="armv7"
options="!check !archcheck"
depends="postmarketos-base linux-samsung-s3ve3g mkbootimg msm-fb-refresher mesa-dri-swrast"
makedepends="devicepkg-dev"
source="
deviceinfo
initfs-hook.sh
udev/60-persistent-v4l.rules
"
build() {
devicepkg_build $startdir $pkgname
}
package() {
devicepkg_package $startdir $pkgname
install -Dm644 "$srcdir"/60-persistent-v4l.rules \
"$pkgdir"/etc/udev/rules.d/60-persistent-v4l.rules
}
sha512sums="9633fad10fd7415b91f55b6d9796108baaf2b0b88b909ff3688041f36e434a9493699865dbd51a1bd4cb0def822c9143900deec02ad676d55826805acb1252bf deviceinfo
b6102448a5c04cc0f8527295f312d38affb250c6c248018f9dbe543d51824f0f32d3ee334d1caee1e630a07b49bda3d81dee50ea3cb04397100f369d308400f7 initfs-hook.sh
b8bf2e3ec166af6acbbfaaa2b57b053473c0b12df007090eecf7a885aee2e3cd5d982819e2ee73e2817e5266b9875dc9240389bca409d5523f3cfa8037fa7870 60-persistent-v4l.rules"

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="Samsung Galaxy S III Neo"
deviceinfo_manufacturer="Samsung"
deviceinfo_codename="samsung-s3ve3g"
deviceinfo_year="2014"
deviceinfo_dtb=""
deviceinfo_modules_initfs=""
deviceinfo_arch="armv7"
# Device related
deviceinfo_chassis="handset"
deviceinfo_keyboard="false"
deviceinfo_external_storage="true"
deviceinfo_screen_width="720"
deviceinfo_screen_height="1280"
# Bootloader related
deviceinfo_flash_method="heimdall-bootimg"
deviceinfo_kernel_cmdline="console=null androidboot.hardware=qcom user_debug=23 msm_rtb.filter=0x37 zcache.enabled=1 zcache.compressor=lz4 buildvariant=userdebug"
deviceinfo_generate_bootimg="true"
deviceinfo_bootimg_qcdt="true"
deviceinfo_bootimg_dtb_second="false"
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_flash_heimdall_partition_kernel="BOOT"
deviceinfo_flash_heimdall_partition_system="SYSTEM"

View file

@ -0,0 +1,6 @@
#!/bin/sh
# Framebuffer
echo 0,1280 > /sys/devices/virtual/graphics/fb0/pan
echo 720,2560 > /sys/devices/virtual/graphics/fb0/virtual_size

View file

@ -0,0 +1,4 @@
# This file is intentionally empty, to disable the default rule with the same name.
# You can find the default rule in /lib/udev/rules.d/60-persistent-v4l.rules.
#
# See https://gitlab.com/postmarketOS/pmaports/-/merge_requests/1160 for why this is needed.

View file

@ -0,0 +1,21 @@
From e1abc8aae14a4c82295b442a4553f18dae24774f Mon Sep 17 00:00:00 2001
From: Snejp <bartosz.dudziak@snejp.pl>
Date: Thu, 4 Jun 2020 12:32:29 +0200
Subject: [PATCH 1/5] remove "Unified Sysfs for GPU" kernel option
This line was added with Samsung Galaxy S5(SM-G900H) kernel import and is not needed.
---
drivers/gpu/Makefile | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/gpu/Makefile b/drivers/gpu/Makefile
index c9355dfc..01cef64b 100644
--- a/drivers/gpu/Makefile
+++ b/drivers/gpu/Makefile
@@ -1,3 +1,2 @@
obj-y += drm/ vga/ stub/ ion/
obj-$(CONFIG_MSM_KGSL) += msm/
-obj-y += gpu_sysfs/
--
2.25.1

View file

@ -0,0 +1,25 @@
From 60d9b247b27bb2ba4d9d64914c4db2f2da3c80e6 Mon Sep 17 00:00:00 2001
From: Snejp <bartosz.dudziak@snejp.pl>
Date: Thu, 4 Jun 2020 12:48:30 +0200
Subject: [PATCH 2/5] always reserve framebuffer memory
---
drivers/video/msm/mdss/mdss_fb.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/video/msm/mdss/mdss_fb.c b/drivers/video/msm/mdss/mdss_fb.c
index f0fbae2d..84d1864a 100644
--- a/drivers/video/msm/mdss/mdss_fb.c
+++ b/drivers/video/msm/mdss/mdss_fb.c
@@ -1211,7 +1211,7 @@ static int mdss_fb_alloc_fbmem_iommu(struct msm_fb_data_type *mfd, int dom)
boot_mode_lpm, boot_mode_recovery);
/* Incase of Normal Booting, Do not reserve FB memory */
- if ((!boot_mode_lpm) && (!boot_mode_recovery)){
+ if (0){
/* Normal Booting */
mfd->fbi->screen_base = NULL;
mfd->fbi->fix.smem_start = 0;
--
2.25.1

View file

@ -0,0 +1,91 @@
From 4c0f27d4d00c21c121fef5adbc2256f392e108ab Mon Sep 17 00:00:00 2001
From: Federico Amedeo Izzo <federico.izzo42@gmail.com>
Date: Fri, 22 Mar 2019 19:37:07 +0100
Subject: [PATCH 3/5] fix video argb setting
---
drivers/video/msm/mdss/mdss_fb.c | 34 ++++++++++++++++----------------
1 file changed, 17 insertions(+), 17 deletions(-)
diff --git a/drivers/video/msm/mdss/mdss_fb.c b/drivers/video/msm/mdss/mdss_fb.c
index 84d1864a..2898eede 100644
--- a/drivers/video/msm/mdss/mdss_fb.c
+++ b/drivers/video/msm/mdss/mdss_fb.c
@@ -1344,16 +1344,16 @@ static int mdss_fb_register(struct msm_fb_data_type *mfd)
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.offset = 24;
+ var->green.offset = 16;
+ var->red.offset = 8;
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.offset = 0;
var->transp.length = 8;
bpp = 4;
break;
@@ -1363,16 +1363,16 @@ static int mdss_fb_register(struct msm_fb_data_type *mfd)
fix->xpanstep = 1;
fix->ypanstep = 1;
var->vmode = FB_VMODE_NONINTERLACED;
- var->blue.offset = 8;
- var->green.offset = 16;
- var->red.offset = 24;
+ var->blue.offset = 16;
+ var->green.offset = 8;
+ var->red.offset = 0;
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 = 0;
+ var->transp.offset = 24;
var->transp.length = 8;
bpp = 4;
break;
@@ -2130,15 +2130,15 @@ static int mdss_fb_check_var(struct fb_var_screeninfo *var,
/* Figure out if the user meant RGBA or ARGB
and verify the position of the RGB components */
- if (var->transp.offset == 24) {
- if ((var->blue.offset != 0) ||
- (var->green.offset != 8) ||
- (var->red.offset != 16))
- return -EINVAL;
- } else if (var->transp.offset == 0) {
- if ((var->blue.offset != 8) ||
+ if (var->transp.offset == 0) {
+ if ((var->blue.offset != 24) ||
(var->green.offset != 16) ||
- (var->red.offset != 24))
+ (var->red.offset != 8))
+ return -EINVAL;
+ } else if (var->transp.offset == 24) {
+ if ((var->blue.offset != 16) ||
+ (var->green.offset != 8) ||
+ (var->red.offset != 0))
return -EINVAL;
} else
return -EINVAL;
@@ -2228,7 +2228,7 @@ static int mdss_fb_set_par(struct fb_info *info)
break;
case 32:
- if (var->transp.offset == 24)
+ if (var->transp.offset == 0)
mfd->fb_imgType = MDP_ARGB_8888;
else
mfd->fb_imgType = MDP_RGBA_8888;
--
2.25.1

View file

@ -0,0 +1,43 @@
From 30d6ccb3594721421c5b16d99c7f88e033adf19e Mon Sep 17 00:00:00 2001
From: Alexey Min <alexey.min@gmail.com>
Date: Thu, 7 Mar 2019 17:25:48 +0300
Subject: [PATCH 4/5] usb_gadget: set random rndis host MAC address to prevent
zero address
This fixes zero host MAC:
rndis0: MAC f6:45:91:9b:4e:43
rndis0: HOST MAC 00:00:00:00:00:00
and allows devive to automatically obtain IP addrest on PC host side
zero MAC address prevented interface from autoconfiguring
---
drivers/usb/gadget/u_ether.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/drivers/usb/gadget/u_ether.c b/drivers/usb/gadget/u_ether.c
index 0b09d5b9..5987611f 100644
--- a/drivers/usb/gadget/u_ether.c
+++ b/drivers/usb/gadget/u_ether.c
@@ -1076,8 +1076,16 @@ int gether_setup_name(struct usb_gadget *g, u8 ethaddr[ETH_ALEN],
"using random %s ethernet address\n", "self");
#ifdef CONFIG_USB_ANDROID_SAMSUNG_COMPOSITE
- memcpy(dev->host_mac, ethaddr, ETH_ALEN);
- printk(KERN_DEBUG "usb: set unique host mac\n");
+ if ((ethaddr[0] == 0x00) && (ethaddr[1] == 0x00) &&
+ (ethaddr[2] == 0x00) && (ethaddr[3] == 0x00) &&
+ (ethaddr[4] == 0x00) && (ethaddr[5] == 0x00)) {
+ printk(KERN_DEBUG "%s: no unique host MAC was set, generate random\n", __func__);
+ /* we can use random_ether_addr() from include/linux/etherdevice.h */
+ random_ether_addr(ethaddr);
+ } else {
+ printk(KERN_DEBUG "%s: set unique host mac\n", __func__);
+ }
+ memcpy(dev->host_mac, ethaddr, ETH_ALEN);
#else
if (get_ether_addr(host_addr, dev->host_mac))
dev_warn(&g->dev,
--
2.25.1

View file

@ -0,0 +1,25 @@
From 6060a61a28db987c10f8bc1ff9781455ea4ba220 Mon Sep 17 00:00:00 2001
From: Snejp <bartosz.dudziak@snejp.pl>
Date: Thu, 4 Jun 2020 15:07:31 +0200
Subject: [PATCH 5/5] alternative patch to fix refresh rate
---
drivers/video/msm/mdss/mdss_fb.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/video/msm/mdss/mdss_fb.c b/drivers/video/msm/mdss/mdss_fb.c
index 2898eede..26855ce7 100644
--- a/drivers/video/msm/mdss/mdss_fb.c
+++ b/drivers/video/msm/mdss/mdss_fb.c
@@ -1433,7 +1433,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;
/* id field for fb app */
--
2.25.1

View file

@ -0,0 +1,63 @@
# Reference: <https://postmarketos.org/vendorkernel>
# Kernel config based on: arch/arm/configs/lineage_s3ve3gxx_defconf
pkgname=linux-samsung-s3ve3g
pkgver=3.4.113
pkgrel=0
pkgdesc="Samsung Galaxy S III Neo kernel fork"
arch="armv7"
_carch="arm"
_flavor="samsung-s3ve3g"
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 dtbtool xz"
# Source
_repository="android_kernel_samsung_msm8226"
_commit="011bada1b7d038d703f4819176cfdf59b3e34e20"
_config="config-$_flavor.$arch"
source="
$pkgname-$_commit.tar.gz::https://github.com/LineageOS/$_repository/archive/$_commit.tar.gz
$_config
gcc7-give-up-on-ilog2-const-optimizations.patch
gcc8-fix-put-user.patch
kernel-use-the-gnu89-standard-explicitly.patch
0001-remove-Unified-Sysfs-for-GPU-kernel-option.patch
0002-always-reserve-framebuffer-memory.patch
0003-fix-video-argb-setting.patch
0004-usb_gadget-set-random-rndis-host-MAC-address-to-prev.patch
0005-alternative-patch-to-fix-refresh-rate.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"
# Master DTB (deviceinfo_bootimg_qcdt)
dtbTool -p scripts/dtc/ -o "$_outdir/arch/$_carch/boot"/dt.img "$_outdir/arch/$_carch/boot/"
install -Dm644 "$_outdir/arch/$_carch/boot"/dt.img "$pkgdir"/boot/dt.img
}
sha512sums="c2984fc0707e00a718c486f31491921c5112ec0c13d4d9d5032f77765859fa4f1989bdcedd8763bb26b6fbbaeae8cef388b1f71ee36e558b1f13950fa5b56071 linux-samsung-s3ve3g-011bada1b7d038d703f4819176cfdf59b3e34e20.tar.gz
8a6280284d3a7774bf33735d2375c926a50a1aba6fc21d1e6f560229be419e5176d38f8a95341cf65c9690104b12a11f70c3b0eee55fcb9b545a998ed39e3047 config-samsung-s3ve3g.armv7
77eba606a71eafb36c32e9c5fe5e77f5e4746caac292440d9fb720763d766074a964db1c12bc76fe583c5d1a5c864219c59941f5e53adad182dbc70bf2bc14a7 gcc7-give-up-on-ilog2-const-optimizations.patch
197d40a214ada87fcb2dfc0ae4911704b9a93354b75179cd6b4aadbb627a37ec262cf516921c84a8b1806809b70a7b440cdc8310a4a55fca5d2c0baa988e3967 gcc8-fix-put-user.patch
ad0182a483791fc88e058838bc331b2f04a75ba291e763767babdb815efadfc3b4fda97e69e2e3f00a426cabea088e35297a92bd287592597d1e309be68ee92c kernel-use-the-gnu89-standard-explicitly.patch
472f2aacb61f66a253113bce3846cb132ce73cf98df4b08245184ac96857f8d3657e80c5ecdabfc04f61ea0971a0e4d2c64dc5886f6c949b560e018e855a5a95 0001-remove-Unified-Sysfs-for-GPU-kernel-option.patch
99710981a40c5ce465fc6de9c438349224c52a4175a0bcbec95bd4d860a44abfa0d59151e94b85a40f049aadff66cb02b74ea84c51424ec5b19b76b17edb5b20 0002-always-reserve-framebuffer-memory.patch
ff4ebae2d4e9d3c78849d9f00879d91a4d554ae68eebe9853388154686f9bd48de1c68e586c855204e6bff61972d2fbc77c5b1c9c6f9ff66e101bc2d04cb5e29 0003-fix-video-argb-setting.patch
9b7fc59035714badcecb5138da4b58d2bda5b8260a04cbad9e1baa57ec6cdebfeea1752744e551a2341e164da78c119564892b43c823aded2f50f2417bbc47ce 0004-usb_gadget-set-random-rndis-host-MAC-address-to-prev.patch
2f8305cd137e5fbc888d3c81201976ae2819275715dde8ee6f63845a0d36021566af8e78ab765e084b6def1bb10cfc4dde1714a472ea4fab8a9c95e7bee9e2c5 0005-alternative-patch-to-fix-refresh-rate.patch"

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1 @@
../../.shared-patches/linux/gcc7-give-up-on-ilog2-const-optimizations.patch

View file

@ -0,0 +1 @@
../../.shared-patches/linux/gcc8-fix-put-user.patch

View file

@ -0,0 +1 @@
../../.shared-patches/linux/kernel-use-the-gnu89-standard-explicitly.patch