Skip to content

gpd/duo: init GPD Duo profile #1524

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 1 addition & 21 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@
gigabyte-b650 = import ./gigabyte/b650;
gmktec-nucbox-g3-plus = import ./gmktec/nucbox/g3-plus;
google-pixelbook = import ./google/pixelbook;
gpd-duo = import ./gpd/duo;
gpd-micropc = import ./gpd/micropc;
gpd-p2-max = import ./gpd/p2-max;
gpd-pocket-3 = import ./gpd/pocket-3;
Expand Down
60 changes: 60 additions & 0 deletions gpd/duo/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
{
config,
lib,
pkgs,
...
}:

let
cfg = config.hardware.gpd.duo;
in
with lib;
{
imports = [
./duo-specific
../../common/pc/laptop
../../common/pc/ssd
../../common/hidpi.nix
];

options = {
hardware.gpd.duo.preventWakeOnAC = mkOption {
type = types.bool;
default = false;
description = ''
Stop the system waking from suspend when the AC is plugged
in. The catch: it also disables waking from the keyboard.

See:
https://community.frame.work/t/tracking-framework-amd-ryzen-7040-series-lid-wakeup-behavior-feedback/39128/45
'';
};
};

config = {
# Workaround applied upstream in Linux >=6.7 (on BIOS 03.03)
# https://github.com/torvalds/linux/commit/a55bdad5dfd1efd4ed9ffe518897a21ca8e4e193
services.udev.extraRules =
mkIf (versionOlder config.boot.kernelPackages.kernel.version "6.7" && cfg.preventWakeOnAC)
''
# Prevent wake when plugging in AC during suspend. Trade-off: keyboard wake disabled. See:
# https://community.frame.work/t/tracking-framework-amd-ryzen-7040-series-lid-wakeup-behavior-feedback/39128/45
ACTION=="add", SUBSYSTEM=="serio", DRIVERS=="atkbd", ATTR{power/wakeup}="disabled"
'';

# Replace 'left' with 'right' or 'inverted' as needed
# Fixes DUO stupid inverted display at boot
# Enable kernel module for your graphics (adjust if needed)
boot.kernelModules = [ "amdgpu" ];

# Set the eDP-1 panel video parameters for display rotation
boot.kernelParams = mkBefore [
"video=eDP-1:2880x1800,panel_orientation=upside_down"
"video=DP-3:2880x1800"
"i2c_touchscreen_props=GXTP7380:touchscreen-inverted-x:touchscreen-inverted-y"
];

hardware.gpd.duo.audioEnhancement.rawDeviceName =
mkDefault "alsa_output.pci-0000_c1_00.6.analog-stereo";
};
}
28 changes: 28 additions & 0 deletions gpd/duo/duo-specific/amd.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{ lib, config, ... }:
with lib;
{
imports = [
../../../common/cpu/amd
../../../common/cpu/amd/pstate.nix
../../../common/gpu/amd
];

boot.kernelParams =
[
# There seems to be an issue with panel self-refresh (PSR) that
# causes hangs for users.
#
# https://community.frame.work/t/fedora-kde-becomes-suddenly-slow/58459
# https://gitlab.freedesktop.org/drm/amd/-/issues/3647
"amdgpu.dcdebugmask=0x210"
]
# Workaround for SuspendThenHibernate: https://lore.kernel.org/linux-kernel/[email protected]/
++ optionals (versionOlder config.boot.kernelPackages.kernel.version "6.8") [
"rtc_cmos.use_acpi_alarm=1"
];

# AMD has better battery life with PPD over TLP:
# https://community.frame.work/t/responded-amd-7040-sleep-states/38101/13
services.power-profiles-daemon.enable = mkDefault true;
services.tlp.enable = mkDefault false;
}
Loading