From 7a0cfe6da4568ab836b8075e2ddfb8ec0659149a Mon Sep 17 00:00:00 2001 From: Decatf Date: Tue, 13 Mar 2018 15:39:07 -0400 Subject: [PATCH] samsung-p4wifi: Load wifi modules, add audio output, remove touch screen calibration (#1328) * [samsung-p4wifi] Include modules in kernel package * [samsung-p4wifi] Load wifi modules at boot * [samsung-p4wifi] Use mainline wm8994 sound driver * [samsung-p4wifi] Add ALSA UCM config Generated from xml2ucm tool. * [samsung-p4wifi] Add headphone jack detect udev rules * [samsung-p4wifi] Remove touchscreen calibration It is not a resistive touchscreen. The default calibration works. --- .../90-device-samsung-p4wifi-audio.rules | 1 + .../90-device-samsung-p4wifi-jack.rules | 2 + device/device-samsung-p4wifi/APKBUILD | 34 ++++++- device/device-samsung-p4wifi/HiFi | 98 +++++++++++++++++++ device/device-samsung-p4wifi/deviceinfo | 2 +- device/device-samsung-p4wifi/modprobe.conf | 1 + .../device-samsung-p4wifi/modules-load.conf | 5 + device/device-samsung-p4wifi/wm8994aif1.conf | 37 +++++++ device/linux-samsung-p4wifi/APKBUILD | 17 +++- .../config-samsung-p4wifi.armhf | 18 ++-- 10 files changed, 199 insertions(+), 16 deletions(-) create mode 100644 device/device-samsung-p4wifi/90-device-samsung-p4wifi-audio.rules create mode 100644 device/device-samsung-p4wifi/90-device-samsung-p4wifi-jack.rules create mode 100644 device/device-samsung-p4wifi/HiFi create mode 100644 device/device-samsung-p4wifi/modprobe.conf create mode 100644 device/device-samsung-p4wifi/modules-load.conf create mode 100644 device/device-samsung-p4wifi/wm8994aif1.conf diff --git a/device/device-samsung-p4wifi/90-device-samsung-p4wifi-audio.rules b/device/device-samsung-p4wifi/90-device-samsung-p4wifi-audio.rules new file mode 100644 index 000000000..0a28d5f56 --- /dev/null +++ b/device/device-samsung-p4wifi/90-device-samsung-p4wifi-audio.rules @@ -0,0 +1 @@ +ATTRS{id}=="wm8994aif1", RUN+="/usr/bin/alsaucm -c wm8994aif1 set _verb HiFi set _enadev Headphones" \ No newline at end of file diff --git a/device/device-samsung-p4wifi/90-device-samsung-p4wifi-jack.rules b/device/device-samsung-p4wifi/90-device-samsung-p4wifi-jack.rules new file mode 100644 index 000000000..ec2a40f3a --- /dev/null +++ b/device/device-samsung-p4wifi/90-device-samsung-p4wifi-jack.rules @@ -0,0 +1,2 @@ +SUBSYSTEM=="extcon", ATTR{name}=="sec-jack", ATTR{state}=="HEADPHONE=1", RUN+="/usr/bin/alsaucm -c wm8994aif1 set _verb HiFi set _enadev Headphones" +SUBSYSTEM=="extcon", ATTR{name}=="sec-jack", ATTR{state}=="HEADPHONE=0", RUN+="/usr/bin/alsaucm -c wm8994aif1 set _verb HiFi set _enadev Speaker" diff --git a/device/device-samsung-p4wifi/APKBUILD b/device/device-samsung-p4wifi/APKBUILD index 65b02173d..534bc0b75 100644 --- a/device/device-samsung-p4wifi/APKBUILD +++ b/device/device-samsung-p4wifi/APKBUILD @@ -2,15 +2,21 @@ pkgname="device-samsung-p4wifi" pkgdesc="Galaxy Tab 10.1" pkgver=0.1 -pkgrel=2 +pkgrel=4 url="https://postmarketos.org" license="MIT" arch="noarch" options="!check" -depends="postmarketos-base linux-samsung-p4wifi mkbootimg mesa-dri-swrast" +depends="postmarketos-base linux-samsung-p4wifi mkbootimg mesa-dri-swrast alsa-utils" makedepends="devicepkg-dev" subpackages="$pkgname-nonfree-firmware:nonfree_firmware" -source="deviceinfo" +source="deviceinfo + modules-load.conf + modprobe.conf + 90-device-samsung-p4wifi-audio.rules + 90-device-samsung-p4wifi-jack.rules + HiFi + wm8994aif1.conf" build() { devicepkg_build $startdir $pkgname @@ -18,6 +24,20 @@ build() { package() { devicepkg_package $startdir $pkgname + + install -D -m644 "$srcdir"/modules-load.conf \ + "$pkgdir"/etc/modules-load.d/00-${pkgname}.conf + install -D -m644 "$srcdir"/modprobe.conf \ + "$pkgdir"/etc/modprobe.d/00-${pkgname}.conf + + install -D -m644 "$srcdir"/HiFi \ + "$pkgdir"/usr/share/alsa/ucm/wm8994aif1/HiFi + install -D -m644 "$srcdir"/wm8994aif1.conf \ + "$pkgdir"/usr/share/alsa/ucm/wm8994aif1/wm8994aif1.conf + install -D -m644 "$srcdir"/90-device-samsung-p4wifi-audio.rules \ + "$pkgdir"/etc/udev/rules.d/90-device-samsung-p4wifi-audio.rules + install -D -m644 "$srcdir"/90-device-samsung-p4wifi-jack.rules \ + "$pkgdir"/etc/udev/rules.d/90-device-samsung-p4wifi-jack.rules } nonfree_firmware() { @@ -26,4 +46,10 @@ nonfree_firmware() { mkdir "$subpkgdir" } -sha512sums="1a7c18122a83ec6f1e49708170b870b7275afd73f40db5aa2dea2776105c37b945d70e962e9d502e0bb985e52759d22a3bf35d33ce38086aa09734ef3f5b42a1 deviceinfo" +sha512sums="eada1b16fca29920a4e838165c38ba997b0c2faca83dabc9250d1fcb4ff70a4ad469c333abfe4bbb6a4cde6282e9fe4ab67323a2255d19f38be75d2abab333bd deviceinfo +d8ce60ea7acaabf627ddca2f0887a4cda46f313b7aaf7934bef2fef8a6e0798ccefab849e4571e4e3fcd06ae34c1a6efe3b58b401e2e443416f6200e6d4ea769 modules-load.conf +56b865bab0714aed53bd6535ebefd2f3629ec78786e8f87dcae4637cfacb5912d28dc39d1fe0287d34bb36b4a8371481f54647e1b25190afbcd23ed30fe7edac modprobe.conf +559d3f49a2a99445c644f53b1148fbac6963cc27fc77ba735da7b6c742b8d4faecf938943ce598ea71d590ce2297e2ec6f98aec54b2b339c861f92d0e0430434 90-device-samsung-p4wifi-audio.rules +0ba8fc472df6a2a420c963d637bebe0cb167f593c50b1cd0dfb654375a1d16de99590dc5e48d0f42e7d44b6fe2ffa9dbfec062a32483d1b5ed32f383cd29ed22 90-device-samsung-p4wifi-jack.rules +a62bbae27b3e76e5ba4b3d06fdd3a35e14b69319b213724196b5ab8acf2086bdf6aef3feef20b262294860f03b8b202a094702af458fe1cfff74c5a17a1cd915 HiFi +16640080221d6ce6b87eb02bef401a18152008f75e52c0db2eee0a67f1ac65fc9ed053cc2388012f3f661e8f5526e8133af4ae2a5176441fde382597c02a75fa wm8994aif1.conf" diff --git a/device/device-samsung-p4wifi/HiFi b/device/device-samsung-p4wifi/HiFi new file mode 100644 index 000000000..528bb4001 --- /dev/null +++ b/device/device-samsung-p4wifi/HiFi @@ -0,0 +1,98 @@ +SectionVerb { + EnableSequence [ + cdev "hw:wm8994aif1" + + ] + + DisableSequence [ + cdev "hw:wm8994aif1" + + ] + + Value { + PlaybackPCM "hw:wm8994aif1,0" + CapturePCM "hw:wm8994aif1,0" + } + +} + +SectionDevice."Speaker" { + Comment "Speaker Rx device" + + ConflictingDevice [ + "Headphones" + ] + + EnableSequence [ + cdev "hw:wm8994aif1" + + cset "name='DAC1R Mixer AIF1.1 Switch' 1" + cset "name='DAC1L Mixer AIF1.1 Switch' 1" + cset "name='DAC1 Switch' 1" + cset "name='AIF1DAC1 EQ Switch' 1" + cset "name='AIF1DAC1 EQ1 Volume' 3" + cset "name='AIF1DAC1 EQ2 Volume' 8" + cset "name='AIF1DAC1 EQ3 Volume' 16" + cset "name='AIF1DAC1 EQ4 Volume' 10" + cset "name='AIF1DAC1 EQ5 Volume' 11" + cset "name='Speaker Switch' 1" + cset "name='SPKR DAC1 Switch' 1" + cset "name='SPKL DAC1 Switch' 1" + cset "name='Speaker Mixer Volume' 3" + cset "name='Speaker Boost Volume' 5" + cset "name='AIF1DAC1 DRC Switch' 1" + cset "name='Speaker Volume' 61" + cset "name='Speaker Volume' 62" + ] + + DisableSequence [ + cdev "hw:wm8994aif1" + + cset "name='DAC1R Mixer AIF1.1 Switch' 1" + cset "name='DAC1L Mixer AIF1.1 Switch' 1" + cset "name='DAC1 Switch' 1" + cset "name='Speaker Switch' 0" + cset "name='SPKR DAC1 Switch' 1" + cset "name='SPKL DAC1 Switch' 1" + cset "name='Speaker Mixer Volume' 1" + ] + + Value { + PlaybackChannels "2" + } + +} + +SectionDevice."Headphones" { + Comment "Headset Rx device" + + ConflictingDevice [ + "Speaker" + ] + + EnableSequence [ + cdev "hw:wm8994aif1" + + cset "name='DAC1R Mixer AIF1.1 Switch' 1" + cset "name='DAC1L Mixer AIF1.1 Switch' 1" + cset "name='DAC1 Switch' 1" + cset "name='AIF1DAC1 EQ Switch' 0" + cset "name='Headphone Switch' 1" + cset "name='Headphone Volume' 35" + ] + + DisableSequence [ + cdev "hw:wm8994aif1" + + cset "name='DAC1R Mixer AIF1.1 Switch' 1" + cset "name='DAC1L Mixer AIF1.1 Switch' 1" + cset "name='DAC1 Switch' 1" + cset "name='Headphone Switch' 0" + ] + + Value { + PlaybackChannels "2" + } + +} + diff --git a/device/device-samsung-p4wifi/deviceinfo b/device/device-samsung-p4wifi/deviceinfo index 5c2dc1cd8..37714cd60 100644 --- a/device/device-samsung-p4wifi/deviceinfo +++ b/device/device-samsung-p4wifi/deviceinfo @@ -15,7 +15,7 @@ deviceinfo_external_storage="false" deviceinfo_screen_width="1280" deviceinfo_screen_height="720" deviceinfo_dev_touchscreen="/dev/input/event5" -deviceinfo_dev_touchscreen_calibration="1.052582 -0.015181 -10.495483 0.003163 0.961493 -1.954590" +deviceinfo_dev_touchscreen_calibration="" deviceinfo_dev_keyboard="" # Bootloader related diff --git a/device/device-samsung-p4wifi/modprobe.conf b/device/device-samsung-p4wifi/modprobe.conf new file mode 100644 index 000000000..b154a63ad --- /dev/null +++ b/device/device-samsung-p4wifi/modprobe.conf @@ -0,0 +1 @@ +options brcmfmac alternative_fw_path=postmarketos \ No newline at end of file diff --git a/device/device-samsung-p4wifi/modules-load.conf b/device/device-samsung-p4wifi/modules-load.conf new file mode 100644 index 000000000..a52c413a5 --- /dev/null +++ b/device/device-samsung-p4wifi/modules-load.conf @@ -0,0 +1,5 @@ +# This file contains the names of kernel modules that should be loaded +# at boot time, one per line. Lines beginning with "#" are ignored. + +# wifi module +brcmfmac diff --git a/device/device-samsung-p4wifi/wm8994aif1.conf b/device/device-samsung-p4wifi/wm8994aif1.conf new file mode 100644 index 000000000..f8f3e54d3 --- /dev/null +++ b/device/device-samsung-p4wifi/wm8994aif1.conf @@ -0,0 +1,37 @@ +SectionUseCase."HiFi" { + File "HiFi" + Comment "Play HiFi quality Music" + +} + +SectionDefaults [ + cdev "hw:wm8994aif1" + + cset "name='Headphone Switch' 0" + cset "name='Speaker Switch' 0" + cset "name='MIXINL IN1L Switch' 0" + cset "name='MIXINR IN1R Switch' 0" + cset "name='DAC1 Switch' 1" + cset "name='DAC1L Mixer AIF1.1 Switch' 1" + cset "name='DAC1R Mixer AIF1.1 Switch' 1" + cset "name='Left Headphone Mux' DAC" + cset "name='Right Headphone Mux' DAC" + cset "name='SPKL DAC1 Switch' 1" + cset "name='SPKR DAC1 Switch' 1" + cset "name='SPKL Boost SPKL Switch' 1" + cset "name='SPKL Boost SPKR Switch' 1" + cset "name='Speaker Mixer Volume' 1" + cset "name='IN1L PGA IN1LP Switch' 0" + cset "name='IN1L PGA IN1LN Switch' 0" + cset "name='MIXINL IN1L Volume' 1" + cset "name='IN1L Switch' 1" + cset "name='IN1L Volume' 23" + cset "name='IN1R PGA IN1RP Switch' 0" + cset "name='IN1R PGA IN1RN Switch' 0" + cset "name='MIXINR IN1R Volume' 1" + cset "name='IN1R Switch' 1" + cset "name='IN1R Volume' 23" + cset "name='AIF1ADC1L Mixer ADC/DMIC Switch' 1" + cset "name='AIF1ADC1R Mixer ADC/DMIC Switch' 1" +] + diff --git a/device/linux-samsung-p4wifi/APKBUILD b/device/linux-samsung-p4wifi/APKBUILD index 2afa9a106..7ac90538e 100644 --- a/device/linux-samsung-p4wifi/APKBUILD +++ b/device/linux-samsung-p4wifi/APKBUILD @@ -1,7 +1,7 @@ # Kernel config based on: arch/arm/configs/tegra_android_defconfig pkgname="linux-samsung-p4wifi" -pkgver=4.14.0 +pkgver=4.14.18 pkgrel=0 pkgdesc="Galaxy Tab 10.1 kernel" arch="armhf" @@ -16,7 +16,7 @@ HOSTCC="${HOSTCC#${CROSS_COMPILE}}" # Source _repository="linux" -_rev="742ba99a0bde5734d5ba9ef0361e3747773c05f3" +_rev="e64e8ca4def3037aab04f409fe1a0749f25a7953" _config="config-${_flavor}.${arch}" source=" $pkgname-$_rev.tar.gz::https://github.com/decatf/${_repository}/archive/${_rev}.tar.gz @@ -75,8 +75,17 @@ package() { error "Could not find zImage in $PWD!" return 1 fi + + # Modules + cd "$builddir" + unset LDFLAGS + make ARCH="$_carch" CC="${CC:-gcc}" \ + CONFIG_NO_ERROR_ON_MISMATCH=y \ + KBUILD_BUILD_VERSION="$((pkgrel + 1))-postmarketOS" \ + INSTALL_MOD_PATH="$pkgdir" INSTALL_MOD_STRIP=1 \ + modules_install } -sha512sums="6bf209fb92b5da9f1a633b12701719bcb5576d128fa104e812a4e640737b827e3294cf1ccde4c7d0a8e410b990974bfb3b9f4151f7d7c13c9a37f2e586bd7cbe linux-samsung-p4wifi-742ba99a0bde5734d5ba9ef0361e3747773c05f3.tar.gz -03a61b17390f2d7a7a5408e970ef59290cb44aedc5224225a363fc2a3869f0e8720e44e38743342bc339adb7dd08804705a463779da76a710bea5e69b246f47e config-samsung-p4wifi.armhf +sha512sums="34a259ad33c11b116be940f4ae30dfa2445b3ebc2855422cda9df515c0262da8be74fa0f4ea71321c70c229a0240ae0d76fcb025c9d448326569d87e0bfa13b0 linux-samsung-p4wifi-e64e8ca4def3037aab04f409fe1a0749f25a7953.tar.gz +b9070eb4a1ff2e456df8f38822f27c8e15daca212f3e7a7ea3f33ebf6fc5ebbb7b5607567bf3180c8b077b8ba6b6c17410a0c9871052c7d8c2d666ad1b55280e config-samsung-p4wifi.armhf d80980e9474c82ba0ef1a6903b434d8bd1b092c40367ba543e72d2c119301c8b2d05265740e4104ca1ac5d15f6c4aa49e8776cb44264a9a28dc551e0d1850dcc compiler-gcc6.h" diff --git a/device/linux-samsung-p4wifi/config-samsung-p4wifi.armhf b/device/linux-samsung-p4wifi/config-samsung-p4wifi.armhf index 34dc308c6..5a00ab5cd 100644 --- a/device/linux-samsung-p4wifi/config-samsung-p4wifi.armhf +++ b/device/linux-samsung-p4wifi/config-samsung-p4wifi.armhf @@ -1259,7 +1259,9 @@ CONFIG_FW_LOADER=y # CONFIG_FIRMWARE_IN_KERNEL is not set CONFIG_EXTRA_FIRMWARE="" # CONFIG_FW_LOADER_USER_HELPER_FALLBACK is not set +CONFIG_WANT_DEV_COREDUMP=y CONFIG_ALLOW_DEV_COREDUMP=y +CONFIG_DEV_COREDUMP=y # CONFIG_DEBUG_DRIVER is not set # CONFIG_DEBUG_DEVRES is not set # CONFIG_DEBUG_TEST_DRIVER_REMOVE is not set @@ -1271,6 +1273,7 @@ CONFIG_SOC_BUS=y CONFIG_REGMAP=y CONFIG_REGMAP_I2C=y CONFIG_REGMAP_MMIO=y +CONFIG_REGMAP_IRQ=y CONFIG_DMA_SHARED_BUFFER=y # CONFIG_DMA_FENCE_TRACE is not set CONFIG_DMA_CMA=y @@ -2180,6 +2183,7 @@ CONFIG_GPIO_TEGRA=y # # CONFIG_HTC_EGPIO is not set CONFIG_GPIO_TPS6586X=y +# CONFIG_GPIO_WM8994 is not set # # USB GPIO expanders @@ -2463,7 +2467,7 @@ CONFIG_MFD_TPS6586X=y # CONFIG_MFD_WM8400 is not set # CONFIG_MFD_WM831X_I2C is not set # CONFIG_MFD_WM8350_I2C is not set -# CONFIG_MFD_WM8994 is not set +CONFIG_MFD_WM8994=y CONFIG_REGULATOR=y # CONFIG_REGULATOR_DEBUG is not set CONFIG_REGULATOR_FIXED_VOLTAGE=y @@ -2501,6 +2505,7 @@ CONFIG_REGULATOR_GPIO=y # CONFIG_REGULATOR_TPS65132 is not set CONFIG_REGULATOR_TPS6586X=y # CONFIG_REGULATOR_VCTRL is not set +CONFIG_REGULATOR_WM8994=y CONFIG_RC_CORE=y CONFIG_RC_MAP=y CONFIG_RC_DECODERS=y @@ -2775,6 +2780,7 @@ CONFIG_SND_SOC_TEGRA20_SPDIF=y # CONFIG_SND_SOC_TEGRA_RT5640 is not set # CONFIG_SND_SOC_TEGRA_WM8753 is not set # CONFIG_SND_SOC_TEGRA_WM8903 is not set +CONFIG_SND_SOC_TEGRA_WM8994=y # CONFIG_SND_SOC_TEGRA_WM9712 is not set # CONFIG_SND_SOC_TEGRA_TRIMSLICE is not set # CONFIG_SND_SOC_TEGRA_ALC5632 is not set @@ -2783,16 +2789,13 @@ CONFIG_SND_SOC_TEGRA20_SPDIF=y # CONFIG_SND_SOC_TEGRA_SGTL5000 is not set # CONFIG_SND_SOC_XTFPGA_I2S is not set # CONFIG_ZX_TDM is not set -CONFIG_SND_VOODOO=y -CONFIG_SND_VOODOO_HP_LEVEL_CONTROL=y -CONFIG_SND_VOODOO_HP_LEVEL=47 -CONFIG_SND_VOODOO_RECORD_PRESETS=y -# CONFIG_SND_VOODOO_DEVELOPMENT is not set +# CONFIG_SND_VOODOO is not set CONFIG_SND_SOC_I2C_AND_SPI=y # # CODEC drivers # +CONFIG_SND_SOC_WM_HUBS=y # CONFIG_SND_SOC_AC97_CODEC is not set # CONFIG_SND_SOC_ADAU1701 is not set # CONFIG_SND_SOC_ADAU1761_I2C is not set @@ -2872,7 +2875,8 @@ CONFIG_SND_SOC_SPDIF=y # CONFIG_SND_SOC_WM8974 is not set # CONFIG_SND_SOC_WM8978 is not set # CONFIG_SND_SOC_WM8985 is not set -CONFIG_SND_SOC_WM8994_P4=y +CONFIG_SND_SOC_WM8994=y +# CONFIG_SND_SOC_WM8994_P4 is not set # CONFIG_SND_SOC_ZX_AUD96P22 is not set # CONFIG_SND_SOC_NAU8540 is not set # CONFIG_SND_SOC_NAU8810 is not set