-
-
Notifications
You must be signed in to change notification settings - Fork 641
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pine64 PinePhone Pro #1073
Draft
zimward
wants to merge
4
commits into
NixOS:master
Choose a base branch
from
zimward:pinephone-pro
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Pine64 PinePhone Pro #1073
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Pine64 PinePhone Pro | ||
## Bootloader | ||
Either [Tow-Boot](https://github.com/Tow-Boot/Tow-Boot) or Megi's [rk2aw](https://xnux.eu/rk2aw/) are recommended to | ||
allow boot via `boot.loader.generic-extlinux-compatible`. rk2aw features a touch-based boot selection which should | ||
provide the ability to choose the NixOS generation. | ||
|
||
## Known Issues | ||
- Audio is currently broken | ||
- The `brcmfmac` driver regularly spews the following error `brcmf_set_channel: set chanspec 0x???? fail, reason -52` | ||
this has been somewhat alleviated by [disabling SAE](./wifi.nix#L7) to the point of allowing WiFi to function | ||
but the issue still remains. | ||
- The cameras are curretly broken, patches exist but need to be rebased to be applicable | ||
- panfrost crashes sometimes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
{ | ||
pkgs, | ||
lib, | ||
config, | ||
... | ||
}: | ||
let | ||
cfg = config.hardware.pinephone-pro; | ||
in | ||
{ | ||
imports = [ ./wifi.nix ]; | ||
options.hardware.pinephone-pro = { | ||
install-ucm2-rules = lib.mkOption { | ||
type = lib.types.bool; | ||
default = true; | ||
description = '' | ||
Whether to install PinePhone Pro specific UCM2 rules. | ||
These provide audio usecaseses for HiFi audio and Voice calls. | ||
''; | ||
}; | ||
}; | ||
config = { | ||
nixpkgs.overlays = [ | ||
(final: _prev: { | ||
pine64-alsa-ucm = final.callPackage ./pine64-alsa-ucm { }; | ||
firmware_pinephone-pro = pkgs.callPackage ./firmware.nix { }; | ||
linuxPackages_pinephone-pro = pkgs.callPackage ./kernel { inherit (config.boot) kernelPatches; }; | ||
}) | ||
]; | ||
hardware.firmware = [ pkgs.firmware_pinephone-pro ]; | ||
environment.systemPackages = lib.optionals cfg.install-ucm2-rules [ pkgs.pine64-alsa-ucm ]; | ||
|
||
boot = { | ||
kernelPackages = pkgs.linuxPackagesFor pkgs.linuxPackages_pinephone-pro; | ||
loader = { | ||
generic-extlinux-compatible.enable = true; | ||
grub.enable = false; | ||
}; | ||
}; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
# MIT License | ||
|
||
# Copyright (c) 2018-2020 Samuel Dionne-Riel and the Mobile NixOS contributors | ||
|
||
# Permission is hereby granted, free of charge, to any person obtaining a copy | ||
# of this software and associated documentation files (the "Software"), to deal | ||
# in the Software without restriction, including without limitation the rights | ||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
# copies of the Software, and to permit persons to whom the Software is | ||
# furnished to do so, subject to the following conditions: | ||
|
||
# The above copyright notice and this permission notice shall be included in all | ||
# copies or substantial portions of the Software. | ||
|
||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
# SOFTWARE. | ||
|
||
{ | ||
runCommand, | ||
firmwareLinuxNonfree, | ||
fetchgit, | ||
fetchFromGitLab, | ||
}: | ||
|
||
let | ||
pinephonepro-firmware = fetchFromGitLab { | ||
domain = "gitlab.manjaro.org"; | ||
owner = "tsys"; | ||
repo = "pinebook-firmware"; | ||
rev = "937f0d52d27d7712da6a008d35fd7c2819e2b077"; | ||
sha256 = "sha256-Ij5u4IF55kPFs1BGq/sLlI3fjufwSjqrf8OZ2WnvjWI="; | ||
}; | ||
ap6256-firmware = fetchFromGitLab { | ||
domain = "gitlab.manjaro.org"; | ||
owner = "manjaro-arm"; | ||
repo = "packages%2Fcommunity%2Fap6256-firmware"; | ||
rev = "a30bf312b268eab42d38fab0cc3ed3177895ff5d"; | ||
sha256 = "sha256-i2OEkn7RtEMbJd0sYEE2Hpkvw6KRppz5AbwXJFNa/pE="; | ||
}; | ||
brcm-firmware = fetchgit { | ||
url = "https://megous.com/git/linux-firmware"; | ||
rev = "6e8e591e17e207644dfe747e51026967bb1edab5"; | ||
sha256 = "sha256-TaGwT0XvbxrfqEzUAdg18Yxr32oS+RffN+yzSXebtac="; | ||
}; | ||
in | ||
|
||
# The minimum set of firmware files required for the device. | ||
runCommand "pine64-pinephonepro-firmware" { src = firmwareLinuxNonfree; } '' | ||
for firmware in \ | ||
rockchip/dptx.bin \ | ||
; do | ||
mkdir -p "$(dirname $out/lib/firmware/$firmware)" | ||
cp -vrf "$src/lib/firmware/$firmware" $out/lib/firmware/$firmware | ||
done | ||
|
||
(PS4=" $ "; set -x | ||
mkdir -p $out/lib/firmware/{brcm,rockchip} | ||
(cd ${ap6256-firmware} | ||
cp -fv *.hcd *blob *.bin *.txt $out/lib/firmware/brcm/ | ||
) | ||
cp -fv ${pinephonepro-firmware}/brcm/* $out/lib/firmware/brcm/ | ||
cp -fv ${pinephonepro-firmware}/rockchip/* $out/lib/firmware/rockchip/ | ||
cp -fv ${brcm-firmware}/brcm/*43455* $out/lib/firmware/brcm/ | ||
) | ||
'' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
source $stdenv/setup | ||
cat $patches | unxz | patch -p1 -N -r -||true | ||
cp -r $src $out |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
{ lib, version }: | ||
with lib.kernel; | ||
with (lib.kernel.whenHelpers version); | ||
{ | ||
|
||
ARCH_ROCKCHIP = yes; | ||
|
||
#charger, should always be included | ||
CHARGER_RK818 = yes; | ||
|
||
#needed for networking via modem as it is connected via usb | ||
USB_USBNET = module; | ||
USB_NET_QMI_WWAN = module; | ||
|
||
DRM_ROCKCHIP = yes; | ||
|
||
#gpu | ||
DRM_PANFROST = module; | ||
|
||
TOUCHSCREEN_GOODIX = module; | ||
|
||
#display | ||
DRM_PANEL_HIMAX_HX8394 = module; | ||
|
||
#WiFi | ||
BRCMFMAC = module; | ||
|
||
#bluetooth | ||
BT_HCIBTSDIO = module; | ||
|
||
#adc | ||
ROCKCHIP_SARADC = module; | ||
|
||
#IMU (also covers the MPU6500) | ||
INV_MPU6050_IIO = module; | ||
|
||
#magnetometer | ||
AF8133J = whenAtLeast "6.9" module; | ||
|
||
#ambient light sensor | ||
STK3310 = module; | ||
|
||
#cameras | ||
VIDEO_OV8858 = module; | ||
VIDEO_IMX258 = module; | ||
|
||
#flash | ||
LEDS_SGM3140 = module; | ||
|
||
#notification LED | ||
LEDS_GPIO = module; | ||
|
||
#vibrator | ||
INPUT_GPIO_VIBRA = module; | ||
|
||
#audio | ||
SND_SOC_RT5616 = module; | ||
SND_SOC_RT5640 = module; | ||
SND_SOC_RK3399_GRU_SOUND = module; | ||
SND_SOC_ROCKCHIP = module; | ||
|
||
#rk video decoder | ||
VIDEO_ROCKCHIP_VDEC = module; | ||
|
||
#buttons | ||
KEYBOARD_ADC = module; | ||
|
||
KEYBOARD_PINEPHONE = module; | ||
|
||
#Uneeded Platforms | ||
ARCH_ACTIONS = no; | ||
ARCH_SUNXI = no; | ||
ARCH_ALPINE = no; | ||
ARCH_APPLE = no; | ||
ARCH_BCM = no; | ||
ARCH_BERLIN = no; | ||
ARCH_BITMAN = no; | ||
ARCH_EXYNOS = no; | ||
ARCH_SPARX5 = no; | ||
ARCH_K3 = no; | ||
ARCH_LG1k = no; | ||
ARCH_HISI = no; | ||
ARCH_KEEMBAY = no; | ||
ARCH_MEDIATEK = no; | ||
ARCH_MESON = no; | ||
ARCH_MVEBU = no; | ||
ARCH_NXP = no; | ||
ARCH_MA35 = no; | ||
ARCH_NPCM = no; | ||
ARCH_QCOM = no; | ||
ARCH_REALTEK = no; | ||
ARCH_RENESAS = no; | ||
ARCH_SEATTLE = no; | ||
ARCH_SOCFPGA = no; | ||
ARCH_STM32 = no; | ||
ARCH_SYNQUACER = no; | ||
ARCH_TEGRA = no; | ||
ARCH_SPRD = no; | ||
ARCH_THUNDER = no; | ||
ARCH_THUNDER2 = no; | ||
ARCH_UNIPHIER = no; | ||
ARCH_VEXPRESS = no; | ||
ARCH_VISCONTI = no; | ||
ARCH_XGENE = no; | ||
ARCH_ZYNQMP = no; | ||
|
||
#Modules that are probably not needed by anyone | ||
DRM_NOUVEAU = no; | ||
DRM_AMDGPU = no; | ||
|
||
#pahole causes OOM(6GiB> including zram) during build, disabling it as a mitigation | ||
CONFIG_BPF = lib.mkForce no; | ||
BPF_SYSCALL = lib.mkForce no; | ||
BPF_JIT = lib.mkForce no; | ||
BPF_JIT_ALWAYS_ON = lib.mkForce no; | ||
BPF_JIT_DEFAULT_ON = lib.mkForce no; | ||
PAHOLE_HAS_BTF_TAG = lib.mkForce no; | ||
DEBUG_INFO_BTF = lib.mkForce no; | ||
DEBUG_INFO_BTF_MODULES = lib.mkForce no; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
{ | ||
lib, | ||
fetchFromGitLab, | ||
fetchurl, | ||
kernelPatches, | ||
callPackage, | ||
buildLinux, | ||
... | ||
}@args: | ||
let | ||
pver = "6.6.44"; | ||
|
||
src_pine64 = fetchFromGitLab { | ||
owner = "pine64-org"; | ||
repo = "linux"; | ||
rev = "ppp-6.6-20231104-22589"; | ||
sha256 = "sha256-wz2g+wE1DmhQQoldeiWEju3PaxSTIcqLSwamjzry+nc="; | ||
}; | ||
#apply mainline fixver patches | ||
upstream_patch = fetchurl { | ||
url = "https://cdn.kernel.org/pub/linux/kernel/v6.x/patch-${pver}.xz"; | ||
hash = "sha256-SSDqB/mqUmEWcf7fhZ3RRvGc2wvauORBuVl2ovJjX5M="; | ||
}; | ||
|
||
ksrc = import ./source.nix; | ||
|
||
apply_patch = ( | ||
path: { | ||
name = builtins.baseNameOf path; | ||
patch = path; | ||
} | ||
); | ||
patches = [ ]; | ||
in | ||
buildLinux ( | ||
args | ||
// { | ||
version = pver; | ||
# todo: find out why builder complains about patch-version | ||
modDirVersion = "${lib.versions.majorMinor pver}.0"; | ||
src = callPackage ksrc { | ||
inherit pver upstream_patch; | ||
src = src_pine64; | ||
}; | ||
features = { }; | ||
structuredExtraConfig = import ./config.nix { | ||
inherit lib; | ||
version = pver; | ||
}; | ||
|
||
kernelPatches = kernelPatches ++ map apply_patch patches; | ||
extraMeta = { | ||
platforms = lib.platforms.aarch64; | ||
hydraPlatforms = [ "aarch64-linux" ]; | ||
}; | ||
} | ||
// args.argsOverride or { } | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
pkgs, | ||
stdenv, | ||
pver, | ||
src, | ||
upstream_patch, | ||
... | ||
}@args: | ||
# Applies the full patch since last mainline which contains some previous patches causing it to fail | ||
# which will work here as the builder doesn't use "set -e" | ||
stdenv.mkDerivation { | ||
name = "kernel-source"; | ||
version = pver; | ||
src = src; | ||
patches = upstream_patch; | ||
buildInputs = [ | ||
pkgs.patch | ||
pkgs.xz | ||
]; | ||
builder = ./builder.sh; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# MIT License | ||
|
||
# Copyright (c) 2018-2020 Samuel Dionne-Riel and the Mobile NixOS contributors | ||
|
||
# Permission is hereby granted, free of charge, to any person obtaining a copy | ||
# of this software and associated documentation files (the "Software"), to deal | ||
# in the Software without restriction, including without limitation the rights | ||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
# copies of the Software, and to permit persons to whom the Software is | ||
# furnished to do so, subject to the following conditions: | ||
|
||
# The above copyright notice and this permission notice shall be included in all | ||
# copies or substantial portions of the Software. | ||
|
||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
# SOFTWARE. | ||
|
||
{ stdenv, pkgs, ... }: | ||
|
||
stdenv.mkDerivation rec { | ||
name = "pine64-alsa-ucm"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nixpkgs maintainer are a bit uneasy to have all these kernel forks in nixpkgs, but I think it would be fine to have this package and the firmware also being part of nixpkgs. |
||
version = "ec0ef36b8b897ed1ae6bb0d0de13d5776f5d3659"; | ||
|
||
src = pkgs.fetchFromGitLab { | ||
owner = "pine64-org"; | ||
repo = "pine64-alsa-ucm"; | ||
rev = version; | ||
sha256 = "sha256-nsZXBB5VpF0YpfIS+/SSHMlPXSyIGLZSOkovjag8ifU="; | ||
}; | ||
|
||
patches = [ ./repoint-pinephone-pro.patch ]; | ||
|
||
installPhase = '' | ||
ucm_path=$out/share/alsa/ucm2/ | ||
|
||
mkdir -p $ucm_path/PinePhone $ucm_path/PinePhonePro $ucm_path/conf.d/simple-card | ||
ln -s ../../PinePhonePro/PinePhonePro.conf $ucm_path/conf.d/simple-card/PinePhonePro.conf | ||
|
||
cp -r ucm2/* $ucm_path/ | ||
''; | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line confuses me.
features
is empty by default and is not passed in on line 27 ofpine64/pinephone-pro/default.nix
.args.argsOverride
comes later, so will override this. Could you explain what this line does?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you are right. i was testing some features and forgot to completely remove it, as it is not present in my current development branch.