mirror of
https://github.com/NixOS/nixos-hardware
synced 2024-06-02 11:03:33 +02:00
Merge branch 'master' into pr/imx-repo-update
This commit is contained in:
commit
4642709710
7
gpd/win-max-2/2023/README.md
Normal file
7
gpd/win-max-2/2023/README.md
Normal file
|
@ -0,0 +1,7 @@
|
|||
# GPD Win Max 2 2023
|
||||
|
||||
## Gyro
|
||||
|
||||
The IMU (Bosch BMI260) is incorrectly identified in the BIOS. It's named BMI0160:00 in ACPI table.
|
||||
|
||||
The IMU is on `/dev/i2c-2`, address `0x69`. It's `CHIP_ID` in reg `0x00` is `0x27`, which could determine that it is actually BMI0260: https://chromium.googlesource.com/chromiumos/platform/ec/+/master/driver/accelgyro_bmi260.h#28
|
33
gpd/win-max-2/2023/bmi260/default.nix
Normal file
33
gpd/win-max-2/2023/bmi260/default.nix
Normal file
|
@ -0,0 +1,33 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
|
||||
bmi260 = config.boot.kernelPackages.callPackage ./package.nix { };
|
||||
|
||||
in
|
||||
{
|
||||
|
||||
meta.maintainers = [ maintainers.Cryolitia ];
|
||||
|
||||
###### interface
|
||||
|
||||
options = {
|
||||
|
||||
hardware.sensor.iio.bmi260.enable = mkOption {
|
||||
default = false;
|
||||
type = types.bool;
|
||||
description = mdDoc ''
|
||||
Enable Bosch BMI260 IMU kernel module driver.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
###### implementation
|
||||
|
||||
config = mkIf config.hardware.sensor.iio.bmi260.enable {
|
||||
boot.extraModulePackages = [ bmi260 ];
|
||||
boot.kernelModules = [ "bmi260_core" "bmi260_i2c" ];
|
||||
};
|
||||
}
|
42
gpd/win-max-2/2023/bmi260/package.nix
Normal file
42
gpd/win-max-2/2023/bmi260/package.nix
Normal file
|
@ -0,0 +1,42 @@
|
|||
{ lib
|
||||
, stdenv
|
||||
, fetchFromGitHub
|
||||
, fetchurl
|
||||
, kernel
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation (finalAttr: {
|
||||
pname = "bmi260";
|
||||
version = "0.0.2";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "hhd-dev";
|
||||
repo = finalAttr.pname;
|
||||
rev = "v${finalAttr.version}";
|
||||
hash = "sha256-J0npD75QqOGY1QUoznBjQ+jX28gq5u6b0JZOseclwE8=";
|
||||
};
|
||||
|
||||
hardeningDisable = [ "pic" ];
|
||||
|
||||
nativeBuildInputs = kernel.moduleBuildDependencies;
|
||||
|
||||
makeFlags = [
|
||||
"KERNEL_SRC=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
|
||||
];
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
install *.ko -Dm444 -t $out/lib/modules/${kernel.modDirVersion}/kernel/drivers/bmi260
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
homepage = "https://github.com/hhd-dev/bmi260";
|
||||
description = "A kernel module driver for the Bosch BMI260 IMU";
|
||||
license = with licenses; [ bsd3 gpl2Only ];
|
||||
maintainers = with maintainers; [ Cryolitia ];
|
||||
platforms = platforms.linux;
|
||||
};
|
||||
})
|
|
@ -6,10 +6,12 @@ with lib;
|
|||
../../../common/cpu/amd
|
||||
../../../common/cpu/amd/pstate.nix
|
||||
../../../common/gpu/amd
|
||||
./bmi260
|
||||
];
|
||||
|
||||
# fix suspend problem: https://www.reddit.com/r/gpdwin/comments/16veksm/win_max_2_2023_linux_experience_suspend_problems/
|
||||
services.udev.extraRules = ''
|
||||
ACTION=="add" SUBSYSTEM=="pci" ATTR{vendor}=="0x1022" ATTR{device}=="0x14ee" ATTR{power/wakeup}="disabled"
|
||||
'';
|
||||
hardware.sensor.iio.bmi260.enable = lib.mkDefault true;
|
||||
|
||||
#see README
|
||||
boot.blacklistedKernelModules = mkIf config.hardware.sensor.iio.bmi260.enable [ "bmi160_spi" "bmi160_i2c" "bmi160_core" ];
|
||||
hardware.sensor.iio.enable = mkIf config.hardware.sensor.iio.bmi260.enable true;
|
||||
}
|
||||
|
|
|
@ -1,3 +1,19 @@
|
|||
{ ... }: {
|
||||
{ pkgs, ... }:
|
||||
|
||||
{
|
||||
imports = [ ../. ];
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
alsa-utils
|
||||
];
|
||||
|
||||
systemd.services.x1-fix = {
|
||||
description = "Use alsa-utils to fix sound interference on Thinkpad x1 Nano";
|
||||
serviceConfig = {
|
||||
Type = "simple";
|
||||
ExecStart = "${pkgs.alsa-tools}/bin/hda-verb /dev/snd/hwC0D0 0x1d SET_PIN_WIDGET_CONTROL 0x0";
|
||||
Restart = "on-failure";
|
||||
};
|
||||
wantedBy = [ "default.target" ];
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user