forked from NixOS/nixos-hardware
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
510: Config settings for Dell XPS 13 / 9300 r=Mic92 a=mexisme Co-authored-by: mexisme <[email protected]>
- Loading branch information
Showing
6 changed files
with
137 additions
and
0 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
= Dell XPS 13 9300 = | ||
|
||
== Firmware upgrades == | ||
|
||
Note that this device is supported by [https://fwupd.org/ fwupd]. | ||
To perform firmware upgrades just activate the service | ||
|
||
<code> | ||
services.fwupd.enable = true; | ||
</code> | ||
|
||
Then use <code>fwupdmgr</code> to perform updates. | ||
|
||
== Battery drain when sleeping == | ||
|
||
The laptop uses the S2 sleep mode by default instead of S3, which leads to | ||
draining a lot of battery during sleep. | ||
|
||
See https://wiki.archlinux.org/index.php/Dell_XPS_13_(9300)#Power_Management | ||
and https://bugzilla.kernel.org/show_bug.cgi?id=199689#c3 for reference |
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,33 @@ | ||
{ config, lib, ... }: | ||
|
||
let | ||
inherit (lib) mkDefault; | ||
|
||
in { | ||
imports = [ | ||
../../../common/cpu/intel | ||
../../../common/gpu/intel.nix | ||
../../../common/pc/laptop | ||
../../../common/pc/laptop/acpi_call.nix | ||
../../../common/pc/ssd | ||
../sleep-resume/i2c-designware | ||
]; | ||
|
||
# Force S3 sleep mode. See README.wiki for details. | ||
boot.kernelParams = [ "mem_sleep_default=deep" ]; | ||
|
||
# Touchpad goes over i2c, and the psmouse module interferes with it | ||
boot.blacklistedKernelModules = [ "psmouse" ]; | ||
|
||
# Includes the Wi-Fi and Bluetooth firmware for the QCA6390. | ||
hardware.enableRedistributableFirmware = mkDefault true; | ||
|
||
# Allows for updating firmware via `fwupdmgr`. | ||
services.fwupd.enable = mkDefault true; | ||
|
||
# This will save you money and possibly your life! | ||
services.thermald.enable = mkDefault true; | ||
|
||
# Reloads i2c-designware module after suspend | ||
services.sleep-resume.i2c-designware.enable = mkDefault true; | ||
} |
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,40 @@ | ||
{config, lib, pkgs, ...}: | ||
|
||
let | ||
inherit (lib) mkIf mkOption types; | ||
|
||
reloadBtusb = pkgs.writeShellApplication { | ||
name = "reload-btusb.sh"; | ||
runtimeInputs = [ | ||
pkgs.coreutils | ||
pkgs.kmod | ||
]; | ||
text = '' | ||
# Reload Bluetooth after resuming from sleep. | ||
# Wait up-to 0.5 second for the module to be unloaded: | ||
# (It should never take this long) | ||
modprobe -r --wait 500 btusb | ||
# "btusb" sometimes seems to need a little bit of time to settle after unloading: | ||
sleep 0.2 | ||
modprobe btusb | ||
''; | ||
}; | ||
|
||
cfg = config.services.sleep-resume.bluetooth; | ||
in { | ||
options = { | ||
services.sleep-resume.bluetooth = { | ||
enable = mkOption { | ||
default = false; | ||
type = types.bool; | ||
description = "Reload Bluetooth after resuming from sleep"; | ||
}; | ||
}; | ||
}; | ||
|
||
config = mkIf cfg.enable { | ||
powerManagement.resumeCommands = "${reloadBtusb}/bin/reload-btusb.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,42 @@ | ||
{ config, lib, pkgs, ... }: | ||
|
||
let | ||
inherit (lib) mkIf mkOption types; | ||
|
||
reloadDesignware = pkgs.writeShellApplication { | ||
name = "reload-i2c-designware.sh"; | ||
runtimeInputs = [ pkgs.kmod ]; | ||
text = '' | ||
# Reload the i2c Designware driver after resuming from sleep. | ||
# Wait up-to 0.5 second for each module to be unloaded: | ||
# (It should never take this long) | ||
modprobe -r --wait 500 i2c_designware_platform | ||
modprobe -r --wait 500 i2c_designware_core | ||
modprobe -r --wait 500 i2c_hid_acpi | ||
modprobe -r --wait 500 i2c_hid | ||
# Should reload the module dependencies automatically: | ||
modprobe i2c_designware_platform | ||
''; | ||
}; | ||
|
||
cfg = config.services.sleep-resume.i2c-designware; | ||
in { | ||
options = { | ||
services.sleep-resume.i2c-designware = { | ||
enable = mkOption { | ||
default = false; | ||
type = types.bool; | ||
description = "Reload the i2c_designware driver after resuming from sleep."; | ||
}; | ||
}; | ||
}; | ||
|
||
config = mkIf cfg.enable { | ||
powerManagement.resumeCommands = "${reloadDesignware}/bin/reload-i2c-designware.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