diff --git a/device/device-xiaomi-santoni/100-charging.rules b/device/device-xiaomi-santoni/100-charging.rules new file mode 100644 index 000000000..85ce6e0c4 --- /dev/null +++ b/device/device-xiaomi-santoni/100-charging.rules @@ -0,0 +1,2 @@ +SUBSYSTEM=="power_supply", ATTRS{type}=="Battery", ATTRS{status}=="Charging", RUN+="/usr/lib/device-xiaomi-santoni/charging.sh" +SUBSYSTEM=="power_supply", ATTRS{type}=="Battery", ATTRS{status}=="Discharging", RUN+="/usr/lib/device-xiaomi-santoni/discharging.sh" diff --git a/device/device-xiaomi-santoni/90-device-xiaomi-santoni-audio.rules b/device/device-xiaomi-santoni/90-device-xiaomi-santoni-audio.rules index eca93584f..e2db18c92 100644 --- a/device/device-xiaomi-santoni/90-device-xiaomi-santoni-audio.rules +++ b/device/device-xiaomi-santoni/90-device-xiaomi-santoni-audio.rules @@ -1 +1,9 @@ -ATTRS{id}=="msm8920sku7sndc", RUN+="/usr/bin/alsaucm -c msm8920-sku7-snd-card set _verb HiFi set _enadev Headphones" +# This udev rule is a workaround, udev doesn't care about the headphone jack input events :( +# We need a better workaround, perhaps a daemon for jack detection? + +# Init +ATTRS{id}=="msm8920sku7sndc", RUN+="/usr/bin/alsaucm -c msm8920-sku7-snd-card set _verb HiFi set _enadev Speaker" + +# Jack detection +SUBSYSTEM=="switch",ATTRS{state}=="[1-4]",RUN+="/usr/bin/alsaucm -c msm8920-sku7-snd-card set _verb HiFi set _enadev Headphones" +SUBSYSTEM=="switch",ATTRS{state}=="0",RUN+="/usr/bin/alsaucm -c msm8920-sku7-snd-card set _verb HiFi set _enadev Speaker" diff --git a/device/device-xiaomi-santoni/APKBUILD b/device/device-xiaomi-santoni/APKBUILD index 9b417e162..209c5c726 100644 --- a/device/device-xiaomi-santoni/APKBUILD +++ b/device/device-xiaomi-santoni/APKBUILD @@ -2,17 +2,24 @@ pkgname="device-xiaomi-santoni" pkgdesc="Xiaomi Redmi 4X" pkgver=0.1 -pkgrel=5 +pkgrel=6 url="https://postmarketos.org" license="MIT" arch="aarch64" +install="$pkgname.post-install" options="!check !archcheck" -depends="postmarketos-base linux-xiaomi-santoni mkbootimg mesa-dri-swrast msm-fb-refresher mdss-fb-init-hack pulseaudio pulseaudio-alsa alsa-utils adsp-audio" +depends="postmarketos-base linux-xiaomi-santoni mkbootimg mesa-dri-swrast msm-fb-refresher mdss-fb-init-hack pulseaudio pulseaudio-alsa alsa-plugins-pulse alsa-utils" makedepends="devicepkg-dev" subpackages="$pkgname-nonfree-firmware:nonfree_firmware" source="deviceinfo 90-device-xiaomi-santoni-audio.rules HiFi + fb.modes + directfbrc + 100-charging.rules + charging.sh + discharging.sh + asound.conf msm8920-sku7-snd-card.conf" build() { @@ -22,14 +29,22 @@ build() { package() { devicepkg_package $startdir $pkgname - mkdir -p "$pkgdir"/usr/share/alsa/ucm/msm8920-sku7-snd-card - - install -D -m644 "$srcdir"/HiFi \ + install -Dm644 "$srcdir"/HiFi \ "$pkgdir"/usr/share/alsa/ucm/msm8920-sku7-snd-card/HiFi - install -D -m644 "$srcdir"/msm8920-sku7-snd-card.conf \ + install -Dm644 "$srcdir"/msm8920-sku7-snd-card.conf \ "$pkgdir"/usr/share/alsa/ucm/msm8920-sku7-snd-card/msm8920-sku7-snd-card.conf - install -D -m644 "$srcdir"/90-device-xiaomi-santoni-audio.rules \ + install -Dm644 "$srcdir"/90-device-xiaomi-santoni-audio.rules \ "$pkgdir"/etc/udev/rules.d/90-device-xiaomi-santoni-audio.rules + install -Dm644 "$srcdir"/asound.conf \ + "$pkgdir"/etc/asound.conf + + install -Dm644 "$srcdir"/fb.modes "$pkgdir"/etc/fb.modes + install -Dm644 "$srcdir"/directfbrc "$pkgdir"/etc/directfbrc + + install -Dm755 "$srcdir"/charging.sh "$pkgdir"/usr/lib/device-xiaomi-santoni/charging.sh + install -Dm755 "$srcdir"/discharging.sh "$pkgdir"/usr/lib/device-xiaomi-santoni/discharging.sh + install -Dm644 "$srcdir"/100-charging.rules \ + "$pkgdir"/etc/udev/rules.d/100-charging.rules } nonfree_firmware() { @@ -39,6 +54,12 @@ nonfree_firmware() { } sha512sums="4a7ba291c30cc5c05cee60f1d54d026b92b270f6499ceb83111cd5c05fe6c6c8182401abc99a8c10d81f0ee95b1414fd72d0aa7f635226f44b9cf659e3cc3471 deviceinfo -f2aeed56b4442ba3d02a06fda69bfc90ffb0128488131cbc96cd1e4d0fc5d3c7e4d08478f7af2c8ee4793462e934307d6607cf4cd32e335a9b0db47f7bd1c3c6 90-device-xiaomi-santoni-audio.rules +dc4bf7871307e659f220aebc3c9f7d74b861f46e1f3df1be37d724af984e46d91e553dbd36c2bd4482aa17dbe4d76d28dabe214952638f00830907466b110146 90-device-xiaomi-santoni-audio.rules 1d2f98a9570212d3026c9565754337574ae046ad4de90265029b7e4a7cd4a2df473ca18ea41d1730f0a01046b40d343446fc88f5d70a1050e0dc578ad460f941 HiFi +b634d13cac1f10535a31c142c7391986ab402ae9910d8093989920f4c2dbd63722ee8595f11962bffd9d314e2835a1ead955a91355856f044911ddcf1e428427 fb.modes +3db3ec596e159be926ea2b5b2496c18e9bc7be24a64a232a56c89a0c9ee710aa2efb2b6fa9fc08efa34759e8242e6c629d08a4ce688ec8aa125830717c191515 directfbrc +7b1b138372cb173be38e820a1c386c3d30930d6753303478ae08c1362de3099d81c26eb2b833c5a0b340a82d821bd53309058ecb9b62e00c7ff323b632af2346 100-charging.rules +c4853babd5cd6371297e5e5d64364c064d540cd4beaba06d79b1001fe5c78fe3ee8bc5f6f4ba3e383743a09263028abc55f41bad45240b1c505e27ed087725c9 charging.sh +6012be4184af6c4f12f9b20a6f2d377ebd72b9b334df4fbb921ed9d8da865633631f77d19b02748ebee70442e2f3ffcb6af511ee5deaa40635bc53730c301076 discharging.sh +b1f374547e9a0ebb99c0740af50ed17d40dfa1e283046ca2aad42a8e31604fee2916612e0579b2dbf1c6cd88a1d2c6117fec7754e745f654a705f8e5073aba92 asound.conf 6cbe9079b6eb1fc889fbb13d8b3da620b39abde3e93e2301601e5416fda8b768aa11876238378af6571ddc3c4ce662dd49f1491cbe8b96153451ffdc7b761926 msm8920-sku7-snd-card.conf" diff --git a/device/device-xiaomi-santoni/asound.conf b/device/device-xiaomi-santoni/asound.conf new file mode 100644 index 000000000..d8eb4cf31 --- /dev/null +++ b/device/device-xiaomi-santoni/asound.conf @@ -0,0 +1,16 @@ +# Use PulseAudio by default +pcm.!default { + type pulse + fallback "sysdefault" + hint { + show on + description "Default ALSA Output (currently PulseAudio Sound Server)" + } +} + +ctl.!default { + type pulse + fallback "sysdefault" +} + +# vim:set ft=alsaconf: diff --git a/device/device-xiaomi-santoni/charging.sh b/device/device-xiaomi-santoni/charging.sh new file mode 100755 index 000000000..d4ebf6a3e --- /dev/null +++ b/device/device-xiaomi-santoni/charging.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +# We'll vibrate a bit here, then turn the led on. +echo 500 > /sys/class/timed_output/vibrator/enable +echo 100 > /sys/class/leds/white/brightness diff --git a/device/device-xiaomi-santoni/device-xiaomi-santoni.post-install b/device/device-xiaomi-santoni/device-xiaomi-santoni.post-install new file mode 100644 index 000000000..1aae37d30 --- /dev/null +++ b/device/device-xiaomi-santoni/device-xiaomi-santoni.post-install @@ -0,0 +1,6 @@ +#!/bin/sh + +# We make sure that tsched has not mentioned anywhere in the default PulseAudio config +if [ "$(grep -c tsched /etc/pulse/default.pa)" -lt "1" ]; then + sed -i 's/load-module module-udev-detect/load-module module-udev-detect tsched=0/g' /etc/pulse/default.pa +fi diff --git a/device/device-xiaomi-santoni/directfbrc b/device/device-xiaomi-santoni/directfbrc new file mode 100644 index 000000000..2f95682a6 --- /dev/null +++ b/device/device-xiaomi-santoni/directfbrc @@ -0,0 +1 @@ +pixelformat=ARGB diff --git a/device/device-xiaomi-santoni/discharging.sh b/device/device-xiaomi-santoni/discharging.sh new file mode 100755 index 000000000..f241fdcaf --- /dev/null +++ b/device/device-xiaomi-santoni/discharging.sh @@ -0,0 +1,2 @@ +#!/bin/sh +echo 0 > /sys/class/leds/white/brightness diff --git a/device/device-xiaomi-santoni/fb.modes b/device/device-xiaomi-santoni/fb.modes new file mode 100644 index 000000000..bc3fa1eed --- /dev/null +++ b/device/device-xiaomi-santoni/fb.modes @@ -0,0 +1,8 @@ +mode "720x1280-60" + # D: 80.457 MHz, H: 78.725 kHz, V: 60.004 Hz + geometry 720 1280 720 1280 16 + timings 12429 180 114 21 7 8 4 + accel false + rgba 8/0,8/8,8/16,8/24 +endmode + diff --git a/device/linux-xiaomi-santoni/APKBUILD b/device/linux-xiaomi-santoni/APKBUILD index 29af00a6a..a556850eb 100644 --- a/device/linux-xiaomi-santoni/APKBUILD +++ b/device/linux-xiaomi-santoni/APKBUILD @@ -1,7 +1,7 @@ # Kernel config based on: arch/arm64/configs/santoni_defconfig pkgname="linux-xiaomi-santoni" pkgver=3.18.138 -pkgrel=0 +pkgrel=1 pkgdesc="Xiaomi Redmi 4X kernel fork - msm-3.18 rebase" arch="aarch64" _carch="arm64" @@ -17,11 +17,12 @@ HOSTCC="${HOSTCC#${CROSS_COMPILE}}" # Source _repository="msm-3.18" -_commit="427ad2094195e9cc991cff577febbf4b12f93293" +_commit="956c047fa31074ee76088f3f673e9fe20e086b74" _config="config-${_flavor}.${arch}" source=" $pkgname-$_commit.tar.gz::https://github.com/bitrvmpd/${_repository}/archive/${_commit}.tar.gz fix-xorg-mdss-update-fb-info.patch + disable-substream-runtime-errors.patch $_config " builddir="$srcdir/${_repository}-${_commit}" @@ -69,6 +70,7 @@ package() { fi } -sha512sums="ea99e08ab18eb39526026aba81242aeda710ec20df731a65017d90ba5b4ba47a22ea38c439572e3e37c6180d1a7d92ceb58e2d2f1d6de18d887b17f5e2175505 linux-xiaomi-santoni-427ad2094195e9cc991cff577febbf4b12f93293.tar.gz +sha512sums="c3b48b61a51a1294f3520086a70b5f2b9fa3c1bcb61febadcb334a46abbea3e05df2ab60eb969552fe605373bde586b64ab78e2fd1a77d6a37bbfcb08d395ad5 linux-xiaomi-santoni-956c047fa31074ee76088f3f673e9fe20e086b74.tar.gz a277af28a718f5caf94257005393aa92d62c96110a8ec6368ff62f2e0d871b69c56c4ce00174db637204d53fa63ad3a79b8d6141713dca0878e1f06fe0379caa fix-xorg-mdss-update-fb-info.patch -faa75f246dae87d7db2e5f35059691194dfce5cb15e0f1d1b94d72a1ff244390373534cc39ccb5795bd3d9bcf5f6b91ade8f547b30119189a01e560af40e7208 config-xiaomi-santoni.aarch64" +14ee08e4f93befeaabfb35e6bf0b8bb5b2eecba1c21ce4498499c377c2cf4d5fccbfe85e14ca92c704d067386ec08a06805ab886f0ec7691471cf379838545aa disable-substream-runtime-errors.patch +cda421f78eb8117f7f0ec94ca9d3d7d0ff6c221c0bee1c1cbf9e6f1acacb56e4c37e35760c9b3d6150ab590f9b28066315d415c7331d9ee914132d2d2dd8a6a0 config-xiaomi-santoni.aarch64" diff --git a/device/linux-xiaomi-santoni/config-xiaomi-santoni.aarch64 b/device/linux-xiaomi-santoni/config-xiaomi-santoni.aarch64 index d968faeeb..343ef9548 100644 --- a/device/linux-xiaomi-santoni/config-xiaomi-santoni.aarch64 +++ b/device/linux-xiaomi-santoni/config-xiaomi-santoni.aarch64 @@ -51,7 +51,7 @@ CONFIG_SYSVIPC=y CONFIG_SYSVIPC_SYSCTL=y # CONFIG_POSIX_MQUEUE is not set CONFIG_CROSS_MEMORY_ATTACH=y -# CONFIG_FHANDLE is not set +CONFIG_FHANDLE=y # CONFIG_USELIB is not set CONFIG_AUDIT=y CONFIG_HAVE_ARCH_AUDITSYSCALL=y @@ -129,7 +129,7 @@ CONFIG_GENERIC_SCHED_CLOCK=y CONFIG_CGROUPS=y # CONFIG_CGROUP_DEBUG is not set CONFIG_CGROUP_FREEZER=y -# CONFIG_CGROUP_DEVICE is not set +CONFIG_CGROUP_DEVICE=y CONFIG_CPUSETS=y CONFIG_PROC_PID_CPUSET=y CONFIG_CGROUP_CPUACCT=y @@ -142,18 +142,19 @@ CONFIG_MEMCG_SWAP_ENABLED=y CONFIG_CGROUP_SCHED=y CONFIG_FAIR_GROUP_SCHED=y CONFIG_CFS_BANDWIDTH=y -CONFIG_RT_GROUP_SCHED=y -# CONFIG_BLK_CGROUP is not set +# CONFIG_RT_GROUP_SCHED is not set +CONFIG_BLK_CGROUP=y +# CONFIG_DEBUG_BLK_CGROUP is not set CONFIG_SCHED_HMP=y # CONFIG_SCHED_HMP_CSTATE_AWARE is not set CONFIG_SCHED_CORE_CTL=y CONFIG_SCHED_QHMP=y -# CONFIG_CHECKPOINT_RESTORE is not set +CONFIG_CHECKPOINT_RESTORE=y CONFIG_NAMESPACES=y -# CONFIG_UTS_NS is not set +CONFIG_UTS_NS=y CONFIG_IPC_NS=y -# CONFIG_USER_NS is not set -# CONFIG_PID_NS is not set +CONFIG_USER_NS=y +CONFIG_PID_NS=y CONFIG_NET_NS=y # CONFIG_SCHED_AUTOGROUP is not set # CONFIG_SCHED_TUNE is not set @@ -273,6 +274,7 @@ CONFIG_BLOCK=y CONFIG_BLK_DEV_BSG=y # CONFIG_BLK_DEV_BSGLIB is not set # CONFIG_BLK_DEV_INTEGRITY is not set +# CONFIG_BLK_DEV_THROTTLING is not set # CONFIG_BLK_CMDLINE_PARSER is not set # @@ -307,6 +309,7 @@ CONFIG_IOSCHED_NOOP=y CONFIG_IOSCHED_TEST=m CONFIG_IOSCHED_DEADLINE=y CONFIG_IOSCHED_CFQ=y +# CONFIG_CFQ_GROUP_IOSCHED is not set # CONFIG_DEFAULT_DEADLINE is not set CONFIG_DEFAULT_CFQ=y # CONFIG_DEFAULT_NOOP is not set @@ -4080,7 +4083,7 @@ CONFIG_EXT3_FS_XATTR=y # CONFIG_EXT3_FS_POSIX_ACL is not set # CONFIG_EXT3_FS_SECURITY is not set CONFIG_EXT4_FS=y -# CONFIG_EXT4_FS_POSIX_ACL is not set +CONFIG_EXT4_FS_POSIX_ACL=y CONFIG_EXT4_FS_SECURITY=y CONFIG_EXT4_ENCRYPTION=y CONFIG_EXT4_FS_ENCRYPTION=y @@ -4098,6 +4101,7 @@ CONFIG_FS_MBCACHE=y # CONFIG_BTRFS_FS is not set # CONFIG_NILFS2_FS is not set CONFIG_FS_POSIX_ACL=y +CONFIG_EXPORTFS=y CONFIG_FILE_LOCKING=y CONFIG_FS_ENCRYPTION=y CONFIG_FSNOTIFY=y @@ -4591,7 +4595,8 @@ CONFIG_CRYPTO_LZ4HC=y # CONFIG_CRYPTO_ANSI_CPRNG=m # CONFIG_CRYPTO_DRBG_MENU is not set -# CONFIG_CRYPTO_USER_API_HASH is not set +CONFIG_CRYPTO_USER_API=y +CONFIG_CRYPTO_USER_API_HASH=y # CONFIG_CRYPTO_USER_API_SKCIPHER is not set CONFIG_CRYPTO_HASH_INFO=y CONFIG_CRYPTO_HW=y diff --git a/device/linux-xiaomi-santoni/disable-substream-runtime-errors.patch b/device/linux-xiaomi-santoni/disable-substream-runtime-errors.patch new file mode 100644 index 000000000..534ed2915 --- /dev/null +++ b/device/linux-xiaomi-santoni/disable-substream-runtime-errors.patch @@ -0,0 +1,89 @@ +From 408331eace24ef1ee4e830502b3355799122c984 Mon Sep 17 00:00:00 2001 +From: Danct12 +Date: Fri, 3 May 2019 01:19:24 +0700 +Subject: [PATCH] Disable substream runtime not found errors + +--- + sound/soc/msm/qdsp6v2/msm-pcm-loopback-v2.c | 4 ++-- + sound/soc/msm/qdsp6v2/msm-pcm-q6-noirq.c | 4 ++-- + sound/soc/msm/qdsp6v2/msm-pcm-q6-v2.c | 6 +++--- + 3 files changed, 7 insertions(+), 7 deletions(-) + +diff --git a/sound/soc/msm/qdsp6v2/msm-pcm-loopback-v2.c b/sound/soc/msm/qdsp6v2/msm-pcm-loopback-v2.c +index 827d079d3968..eff8244065a9 100644 +--- a/sound/soc/msm/qdsp6v2/msm-pcm-loopback-v2.c ++++ b/sound/soc/msm/qdsp6v2/msm-pcm-loopback-v2.c +@@ -490,7 +490,7 @@ static int msm_pcm_volume_ctl_put(struct snd_kcontrol *kcontrol, + + pr_debug("%s: volume : 0x%x\n", __func__, volume); + if ((!substream) || (!substream->runtime)) { +- pr_err("%s substream or runtime not found\n", __func__); ++ //pr_err("%s substream or runtime not found\n", __func__); + rc = -ENODEV; + goto exit; + } +@@ -516,7 +516,7 @@ static int msm_pcm_volume_ctl_get(struct snd_kcontrol *kcontrol, + + pr_debug("%s\n", __func__); + if ((!substream) || (!substream->runtime)) { +- pr_err("%s substream or runtime not found\n", __func__); ++ //pr_err("%s substream or runtime not found\n", __func__); + rc = -ENODEV; + goto exit; + } +diff --git a/sound/soc/msm/qdsp6v2/msm-pcm-q6-noirq.c b/sound/soc/msm/qdsp6v2/msm-pcm-q6-noirq.c +index 289049c7fac2..a256bd1c7bf1 100644 +--- a/sound/soc/msm/qdsp6v2/msm-pcm-q6-noirq.c ++++ b/sound/soc/msm/qdsp6v2/msm-pcm-q6-noirq.c +@@ -579,7 +579,7 @@ static int msm_pcm_volume_ctl_get(struct snd_kcontrol *kcontrol, + return -ENODEV; + } + if (!substream->runtime) { +- pr_err("%s substream runtime not found\n", __func__); ++ //pr_err("%s substream runtime not found\n", __func__); + return 0; + } + prtd = substream->runtime->private_data; +@@ -604,7 +604,7 @@ static int msm_pcm_volume_ctl_put(struct snd_kcontrol *kcontrol, + return -ENODEV; + } + if (!substream->runtime) { +- pr_err("%s substream runtime not found\n", __func__); ++ //pr_err("%s substream runtime not found\n", __func__); + return 0; + } + prtd = substream->runtime->private_data; +diff --git a/sound/soc/msm/qdsp6v2/msm-pcm-q6-v2.c b/sound/soc/msm/qdsp6v2/msm-pcm-q6-v2.c +index e505f416ab2c..7f2fe3b55b98 100644 +--- a/sound/soc/msm/qdsp6v2/msm-pcm-q6-v2.c ++++ b/sound/soc/msm/qdsp6v2/msm-pcm-q6-v2.c +@@ -1137,7 +1137,7 @@ static int msm_pcm_volume_ctl_get(struct snd_kcontrol *kcontrol, + return -ENODEV; + } + if (!substream->runtime) { +- pr_err("%s substream runtime not found\n", __func__); ++ //pr_err("%s substream runtime not found\n", __func__); + return 0; + } + prtd = substream->runtime->private_data; +@@ -1162,7 +1162,7 @@ static int msm_pcm_volume_ctl_put(struct snd_kcontrol *kcontrol, + return -ENODEV; + } + if (!substream->runtime) { +- pr_err("%s substream runtime not found\n", __func__); ++ //pr_err("%s substream runtime not found\n", __func__); + return 0; + } + prtd = substream->runtime->private_data; +@@ -1682,7 +1682,7 @@ static int msm_pcm_chmix_cfg_ctl_put(struct snd_kcontrol *kcontrol, + return -ENODEV; + } + if (!substream->runtime) { +- pr_err("%s substream runtime not found\n", __func__); ++ //pr_err("%s substream runtime not found\n", __func__); + ret = -EINVAL; + goto done; + } +-- +2.21.0 + diff --git a/firmware/firmware-xiaomi-santoni/APKBUILD b/firmware/firmware-xiaomi-santoni/APKBUILD index 9b4435e46..00c8f6336 100644 --- a/firmware/firmware-xiaomi-santoni/APKBUILD +++ b/firmware/firmware-xiaomi-santoni/APKBUILD @@ -1,11 +1,11 @@ pkgname=firmware-xiaomi-santoni pkgver=1 -pkgrel=1 +pkgrel=2 pkgdesc="Firmware files for Xiaomi Redmi 4X" url="https://postmarketos.org" arch="aarch64" license="proprietary" -depends="wcnss-wlan" +depends="wcnss-wlan adsp-audio" options="!strip !check !archcheck" # Source