New device: Samsung Galaxy Note 8.0 (WiFi) n5110 (#1219)

This port includes:
* Weston including touch and WiFi (using e.g. firmware-samsung-i9305) works.
* Touchscreen calibration for osk-sdl
* Sound configuration
* Udev rules for touch and pen, pen works!
This commit is contained in:
Michael Hamann 2018-02-12 20:20:49 +01:00 committed by Oliver Smith
parent e5d88d4de7
commit 1622e2b075
11 changed files with 7080 additions and 0 deletions

View file

@ -0,0 +1,21 @@
# Configure the touch including calibration for wayland and x11
# Add the touch to a group so the pen can be added to the same group
# and then whenever the pen is recognized, regular touch is deactivated.
SUBSYSTEM=="input", ENV{DEVNAME}=="/dev/input/event2", \
ENV{WL_CALIBRATION}="0 1 0 -1 0 800", \
ENV{LIBINPUT_CALIBRATION_MATRIX}="0 1 0 -1 0 1", \
ENV{LIBINPUT_DEVICE_GROUP}="touchpen", \
ENV{ID_INPUT}="1", ENV{ID_INPUT_TOUCHSCREEN}="1"
# Configure the pen including calibration (for x11).
# Further, the resolution needs to be set.
# This could be in hwdb and calls the builtin "keyboard" from (e)udev
# that sets the internal "ABS" property.
# This "resolution" is units/mm.
SUBSYSTEM=="input", ENV{DEVNAME}=="/dev/input/event10", \
ENV{ID_INPUT_TABLET}="1", \
ENV{LIBINPUT_DEVICE_GROUP}="touchpen", \
ENV{LIBINPUT_CALIBRATION_MATRIX}="0 1 0 -1 0 1", \
ENV{EVDEV_ABS_00}="::100", \
ENV{EVDEV_ABS_01}="::100", \
RUN{builtin}+="keyboard"

View file

@ -0,0 +1,39 @@
# Reference: <https://postmarketos.org/devicepkg>
pkgname="device-samsung-n5110"
pkgdesc="Samsung Galaxy Note 8.0 (Wi-Fi)"
pkgver=0.1
pkgrel=0
url="https://postmarketos.org"
license="MIT"
arch="noarch"
options="!check"
depends="linux-samsung-n5110 mkbootimg mesa-dri-swrast"
makedepends="devicepkg-dev"
source="deviceinfo pointercal asound.state Kona_WM1811/hifi.conf Kona_WM1811/Kona_WM1811.conf Kona_WM1811/lp.conf 90-$pkgname.rules"
package() {
devicepkg_package $startdir $pkgname
install -D -m644 "$srcdir/pointercal" \
"$pkgdir/etc/pointercal"
install -D -m644 "$srcdir/asound.state" \
"$pkgdir/var/lib/alsa/asound.state"
install -D -m644 "$srcdir/Kona_WM1811.conf" \
"$pkgdir/usr/share/alsa/ucm/Kona_WM1811/Kona_WM1811.conf"
install -D -m644 "$srcdir/hifi.conf" \
"$pkgdir/usr/share/alsa/ucm/Kona_WM1811/hifi.conf"
install -D -m644 "$srcdir/lp.conf" \
"$pkgdir/usr/share/alsa/ucm/Kona_WM1811/lp.conf"
}
sha512sums="e4247419489bb0a82543f26d038e02eee8a6610f05b3e31330fccb8b9a308c5d387383e44380fb5314f1dc5dc794c23672363e270d7f8f86a3f83627f0ef358d deviceinfo
3143f3c2d884480531dffd970753e884048bae68533a05b457483b0fa2448d7c9150bb649d25056ebe8879675284148f431447644d265cc7440b35320523cd4e pointercal
dbbe2516c347708f72ef2e8fb6a110e6b18234c72f7173940a9a3727c6fd357b449df7c0a5ba223d2571b90249714d811307c3155b8d76974ecb1fe92c5abe98 asound.state
1edafcded27093f6d71b2459e92e59390dfbea50c866612f7b78943dd4b96057649b2ffa677956a2b160956c5d12e8eff76ace7ec91134bafba2b632b461c660 hifi.conf
f885a785caabd7e1d2ccf456a6ad4fa90bf01f76ba94c902a0d55268a8eddbad4b591db524a2359f1b676929d426e892db4597189e91fcd8df06bc54e3555b92 Kona_WM1811.conf
3e0afbb20975be711613a5787635cd4b2b58e2232387e4d6f6910a7b45467fefc57cb4160f00a52db73089fa9523560e1360b045242235eac1cdb6e6f813b06b lp.conf
1be171ab5d36aa6f75c740b7aabe62a78c6d2c1f016b706900f04e1f0e20bf25d090f32d029160c6d626e978a004732b9654dde336748ca47326b9a2e06e34b2 90-device-samsung-n5110.rules"

View file

@ -0,0 +1,17 @@
SectionUseCase."HiFi" {
File "hifi.conf"
Comment "HiFi"
}
SectionUseCase."LowPower" {
File "lp.conf"
Comment "Low power"
}
ValueDefaults {
}
SectionDefaults [
cdev "hw:KonaWM1811"
]

View file

@ -0,0 +1,172 @@
SectionVerb {
EnableSequence [
cdev "hw:KonaWM1811"
cset "name='DAC OSR' 1"
]
DisableSequence [
cdev "hw:KonaWM1811"
cset "name='DAC OSR' 0"
]
Value {
QoS HiFi
}
}
SectionDevice."Speaker" {
Comment "Builtin speaker"
EnableSequence [
cdev "hw:KonaWM1811"
cset "name='SPK Switch' 1"
]
DisableSequence [
cdev "hw:KonaWM1811"
cset "name='SPK Switch' 0"
]
Value {
PlaybackPCM "hw:KonaWM1811,0"
PlaybackChannels "2"
}
MasterPlaybackVolume 'Speaker Volume'
}
SectionDevice."Earphone" {
Comment "3.5mm Earphone"
EnableSequence [
cdev "hw:KonaWM1811"
cset "name='HP Switch' 1"
]
DisableSequence [
cdev "hw:KonaWM1811"
cset "name='HP Switch' 0"
]
Value {
PlaybackPCM "hw:KonaWM1811,0"
PlaybackChannels "2"
}
MasterPlaybackVolume 'Headphone Volume'
}
SectionDevice."Mic" {
Comment "Builtin mic"
EnableSequence [
cdev "hw:KonaWM1811"
cset "name='AIF1ADCL Source' Left"
cset "name='AIF1ADCR Source' Left"
cset "name='AIF1ADC1 HPF Mode' 0"
cset "name='AIF1ADC1 HPF Switch' 1"
cset "name='Main Mic Switch' 1"
cset "name='AIF1ADC1L Mixer ADC/DMIC Switch' 1"
cset "name='AIF1DRC1 Mode' 1"
cset "name='AIF1ADC1L DRC Switch' 1"
cset "name='MIXINL IN1L Switch' 1"
cset "name='IN1L Volume' 11"
cset "name='IN1L Switch' 1"
cset "name='IN1L PGA IN1LN Switch' 1"
cset "name='IN1L PGA IN1LP Switch' 1"
]
DisableSequence [
cdev "hw:KonaWM1811"
cset "name='AIF1ADCL Source' Left"
cset "name='AIF1ADCR Source' Right"
cset "name='AIF1ADC1 HPF Mode' 0"
cset "name='AIF1ADC1 HPF Switch' 0"
cset "name='Main Mic Switch' 0"
cset "name='AIF1ADC1L Mixer ADC/DMIC Switch' 0"
cset "name='AIF1DRC1 Mode' 0"
cset "name='AIF1ADC1L DRC Switch' 0"
cset "name='MIXINL IN1L Switch' 0"
cset "name='IN1L Volume' 0"
cset "name='IN1L Switch' 0"
cset "name='IN1L PGA IN1LN Switch' 0"
cset "name='IN1L PGA IN1LP Switch' 0"
]
Value {
CapturePCM "hw:KonaWM1811,3"
CaptureChannels "2"
}
MasterCaptureVolume "IN1L Volume"
}
SectionDevice."Headset" {
Comment "3.5mm Headset mic"
EnableSequence [
cdev "hw:KonaWM1811"
cset "name='AIF1ADCL Source' Right"
cset "name='AIF1ADCR Source' Right"
cset "name='AIF1ADC1 HPF Mode' 1"
cset "name='AIF1ADC1 HPF Switch' 1"
cset "name='Headset Mic Switch' 1"
cset "name='Sub Mic Switch' 1"
cset "name='AIF1ADC1R Mixer ADC/DMIC Switch' 1"
cset "name='AIF1ADC1R DRC Switch' 1"
cset "name='MIXINR IN1R Switch' 1"
cset "name='IN1R Volume' 11"
cset "name='IN1R Switch' 1"
cset "name='IN1R PGA IN1RN Switch' 1"
cset "name='IN1R PGA IN1RP Switch' 1"
]
DisableSequence [
cdev "hw:KonaWM1811"
cset "name='AIF1ADCL Source' Left"
cset "name='AIF1ADCR Source' Right"
cset "name='AIF1ADC1 HPF Mode' 0"
cset "name='AIF1ADC1 HPF Switch' 0"
cset "name='Headset Mic Switch' 0"
cset "name='Sub Mic Switch' 0"
cset "name='AIF1ADC1R Mixer ADC/DMIC Switch' 0"
cset "name='AIF1ADC1R DRC Switch' 0"
cset "name='MIXINR IN1R Switch' 0"
cset "name='IN1R Volume' 0"
cset "name='IN1R Switch' 0"
cset "name='IN1R PGA IN1RN Switch' 0"
cset "name='IN1R PGA IN1RP Switch' 0"
]
Value {
CapturePCM "hw:KonaWM1811,3"
CaptureChannels "2"
}
MasterCaptureVolume "IN1R Volume"
}
SectionModifier."Boost" {
Comment "Boost Mode"
SupportedDevice [
"Mic"
"Headset"
]
EnableSequence [
cdev "hw:KonaWM1811"
cset "name='MIXINL IN1L Volume' 1"
cset "name='MIXINR IN1R Volume' 1"
]
DisableSequence [
cdev "hw:KonaWM1811"
cset "name='MIXINL IN1L Volume' 0"
cset "name='MIXINR IN1R Volume' 0"
]
}

View file

@ -0,0 +1,164 @@
SectionVerb {
EnableSequence [
cdev "hw:KonaWM1811"
cset "name='DAC OSR' 0"
]
DisableSequence [
cdev "hw:KonaWM1811"
cset "name='DAC OSR' 0"
]
Value {
QoS HiFi
}
}
SectionDevice."Speaker" {
Comment "Builtin speaker"
EnableSequence [
cdev "hw:KonaWM1811"
cset "name='SPK Switch' 1"
]
DisableSequence [
cdev "hw:KonaWM1811"
cset "name='SPK Switch' 0"
]
Value {
PlaybackPCM "hw:KonaWM1811,0"
PlaybackChannels "2"
}
}
SectionDevice."Earphone" {
Comment "3.5mm Earphone"
EnableSequence [
cdev "hw:KonaWM1811"
cset "name='HP Switch' 1"
]
DisableSequence [
cdev "hw:KonaWM1811"
cset "name='HP Switch' 0"
]
Value {
PlaybackPCM "hw:KonaWM1811,0"
PlaybackChannels "2"
}
}
SectionDevice."Mic" {
Comment "Builtin mic"
EnableSequence [
cdev "hw:KonaWM1811"
cset "name='AIF1ADCL Source' Left"
cset "name='AIF1ADCR Source' Left"
cset "name='AIF1ADC1 HPF Mode' 0"
cset "name='AIF1ADC1 HPF Switch' 1"
cset "name='Main Mic Switch' 1"
cset "name='AIF1ADC1L Mixer ADC/DMIC Switch' 1"
cset "name='AIF1DRC1 Mode' 1"
cset "name='AIF1ADC1L DRC Switch' 1"
cset "name='MIXINL IN1L Switch' 1"
cset "name='IN1L Volume' 11"
cset "name='IN1L Switch' 1"
cset "name='IN1L PGA IN1LN Switch' 1"
cset "name='IN1L PGA IN1LP Switch' 1"
]
DisableSequence [
cdev "hw:KonaWM1811"
cset "name='AIF1ADCL Source' Left"
cset "name='AIF1ADCR Source' Right"
cset "name='AIF1ADC1 HPF Mode' 0"
cset "name='AIF1ADC1 HPF Switch' 0"
cset "name='Main Mic Switch' 0"
cset "name='AIF1ADC1L Mixer ADC/DMIC Switch' 0"
cset "name='AIF1DRC1 Mode' 0"
cset "name='AIF1ADC1L DRC Switch' 0"
cset "name='MIXINL IN1L Switch' 0"
cset "name='IN1L Volume' 0"
cset "name='IN1L Switch' 0"
cset "name='IN1L PGA IN1LN Switch' 0"
cset "name='IN1L PGA IN1LP Switch' 0"
]
Value {
CapturePCM "hw:KonaWM1811,3"
CaptureChannels "2"
}
}
SectionDevice."Headset" {
Comment "3.5mm Headset mic"
EnableSequence [
cdev "hw:KonaWM1811"
cset "name='AIF1ADCL Source' Right"
cset "name='AIF1ADCR Source' Right"
cset "name='AIF1ADC1 HPF Mode' 1"
cset "name='AIF1ADC1 HPF Switch' 1"
cset "name='Headset Mic Switch' 1"
cset "name='Sub Mic Switch' 1"
cset "name='AIF1ADC1R Mixer ADC/DMIC Switch' 1"
cset "name='AIF1ADC1R DRC Switch' 1"
cset "name='MIXINR IN1R Switch' 1"
cset "name='IN1R Volume' 11"
cset "name='IN1R Switch' 1"
cset "name='IN1R PGA IN1RN Switch' 1"
cset "name='IN1R PGA IN1RP Switch' 1"
]
DisableSequence [
cdev "hw:KonaWM1811"
cset "name='AIF1ADCL Source' Left"
cset "name='AIF1ADCR Source' Right"
cset "name='AIF1ADC1 HPF Mode' 0"
cset "name='AIF1ADC1 HPF Switch' 0"
cset "name='Headset Mic Switch' 0"
cset "name='Sub Mic Switch' 0"
cset "name='AIF1ADC1R Mixer ADC/DMIC Switch' 0"
cset "name='AIF1ADC1R DRC Switch' 0"
cset "name='MIXINR IN1R Switch' 0"
cset "name='IN1R Volume' 0"
cset "name='IN1R Switch' 0"
cset "name='IN1R PGA IN1RN Switch' 0"
cset "name='IN1R PGA IN1RP Switch' 0"
]
Value {
CapturePCM "hw:KonaWM1811,3"
CaptureChannels "2"
}
}
SectionModifier."Boost" {
Comment "Boost Mode"
SupportedDevice [
"Mic"
"Headset"
]
EnableSequence [
cdev "hw:KonaWM1811"
cset "name='MIXINL IN1L Volume' 1"
cset "name='MIXINR IN1R Volume' 1"
]
DisableSequence [
cdev "hw:KonaWM1811"
cset "name='MIXINL IN1L Volume' 0"
cset "name='MIXINR IN1R Volume' 0"
]
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,35 @@
# 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 Note 8.0 (Wi-Fi)"
deviceinfo_manufacturer="Samsung"
deviceinfo_date=""
deviceinfo_dtb=""
deviceinfo_modules_initfs=""
deviceinfo_external_disk_install="false"
deviceinfo_arch="armhf"
# Device related
deviceinfo_keyboard="false"
deviceinfo_external_disk="true"
deviceinfo_screen_width="1280"
deviceinfo_screen_height="800"
deviceinfo_dev_touchscreen="/dev/input/event2"
deviceinfo_dev_touchscreen_calibration="0 1 0 -1 0 800"
deviceinfo_dev_keyboard=""
# Bootloader related
deviceinfo_flash_method="heimdall-bootimg"
deviceinfo_kernel_cmdline="console=ttySAC2,115200 buildvariant=userdebug"
deviceinfo_generate_bootimg="true"
deviceinfo_bootimg_qcdt="false"
deviceinfo_flash_offset_base="0x40000000"
deviceinfo_flash_offset_kernel="0x00008000"
deviceinfo_flash_offset_ramdisk="0x01000000"
deviceinfo_flash_offset_second="0x00f00000"
deviceinfo_flash_offset_tags="0x00000100"
deviceinfo_flash_pagesize="2048"
deviceinfo_flash_heimdall_partition_kernel="BOOT"
deviceinfo_flash_heimdall_partition_system="SYSTEM"

View file

@ -0,0 +1 @@
0 1 0 -1 0 800 1 1280 800

View file

@ -0,0 +1,79 @@
# Kernel config based on: arch/arm/configs/lineageos_n5110_defconfig
pkgname="linux-samsung-n5110"
pkgver=3.0.101
pkgrel=1
pkgdesc="Samsung Galaxy Note 8.0 (Wi-Fi) kernel fork"
arch="armhf"
_carch="arm"
_flavor="samsung-n5110"
url="https://kernel.org"
license="GPL2"
options="!strip !check !tracedeps"
makedepends="perl sed installkernel bash gmp-dev bc linux-headers elfutils-dev xz"
HOSTCC="${CC:-gcc}"
HOSTCC="${HOSTCC#${CROSS_COMPILE}}"
# Source
_repository="android_kernel_samsung_smdk4412"
_commit="b7ffe7f2aea2391737cdeac2a33217ee0ea4f2ba"
_config="config-${_flavor}.${arch}"
source="
$pkgname-$_commit.tar.gz::https://github.com/LineageOS/${_repository}/archive/${_commit}.tar.gz
$_config
compiler-gcc6.h
"
builddir="$srcdir/${_repository}-${_commit}"
prepare() {
default_prepare
# gcc6 support
cp -v "$srcdir/compiler-gcc6.h" "$builddir/include/linux/"
# Remove -Werror from all makefiles
find . -type f -name Makefile -print0 | \
xargs -0 sed -i 's/-Werror-/-W/g'
find . -type f -name Makefile -print0 | \
xargs -0 sed -i 's/-Werror//g'
# Prepare kernel config ('yes ""' for kernels lacking olddefconfig)
cp "$srcdir"/$_config "$builddir"/.config
yes "" | make ARCH="$_carch" HOSTCC="$HOSTCC" oldconfig
}
menuconfig() {
cd "$builddir"
make ARCH="$_carch" menuconfig
cp .config "$startdir"/$_config
}
build() {
unset LDFLAGS
make ARCH="$_carch" CC="${CC:-gcc}" \
KBUILD_BUILD_VERSION="$((pkgrel + 1 ))-postmarketOS"
}
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
}
sha512sums="7e47ecfa6c3b2f4ac199ceed4103a00a577f9fa0002f5759df570f3c11a3436e53114e87a13e9efd27f2a2e17fcaab1be0666dffaa7d23699e700bee0d2afe33 linux-samsung-n5110-b7ffe7f2aea2391737cdeac2a33217ee0ea4f2ba.tar.gz
0d0219494704891d06c85929ed2d73db49c581874ad04c9e11f625dd06a499854a1ec813dd7073fb9bb88a91f17510ae168e38716986de324e156e45d6fb965e config-samsung-n5110.armhf
d80980e9474c82ba0ef1a6903b434d8bd1b092c40367ba543e72d2c119301c8b2d05265740e4104ca1ac5d15f6c4aa49e8776cb44264a9a28dc551e0d1850dcc compiler-gcc6.h"

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