From 1336203f529cdd6100c9f776f8d56b44f39252d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonardo=20Eug=C3=AAnio?= Date: Sat, 25 Jan 2025 14:28:33 -0300 Subject: [PATCH] amdgpu: remove manual fan control --- hosts/monolith/amdgpu.nix | 13 +-------- scripts/amd-fan-control | 61 --------------------------------------- scripts/default.nix | 1 - 3 files changed, 1 insertion(+), 74 deletions(-) delete mode 100755 scripts/amd-fan-control diff --git a/hosts/monolith/amdgpu.nix b/hosts/monolith/amdgpu.nix index 0da64f0..8c42bf0 100644 --- a/hosts/monolith/amdgpu.nix +++ b/hosts/monolith/amdgpu.nix @@ -1,4 +1,4 @@ -{ pkgs, lib, ... }: +{ pkgs, ... }: let undervoltGpu = pkgs.writeShellScript "undervolt-gpu" '' set -xe @@ -17,17 +17,6 @@ in "amdgpu.ppfeaturemask=0xfffd7fff" # enable undervolting ]; - systemd.services.amd-fan-control = { - script = '' - ${lib.getExe pkgs.amd-fan-control} /sys/class/drm/card1/device 60 100 - ''; - serviceConfig = { - Restart = "always"; - RestartSec = 10; - }; - wantedBy = [ "multi-user.target" ]; - }; - hardware.graphics.enable32Bit = true; hardware.graphics.extraPackages = with pkgs; [ diff --git a/scripts/amd-fan-control b/scripts/amd-fan-control deleted file mode 100755 index 1f4c3e7..0000000 --- a/scripts/amd-fan-control +++ /dev/null @@ -1,61 +0,0 @@ -#!/usr/bin/env bash - -set -e - -DEVICE="$1" # eg: /sys/class/drm/card1/device -HWMON=$(echo "$DEVICE"/hwmon/hwmon*) - -exit() { - echo "Setting controll to auto" >&2 - echo 2 > "$HWMON/pwm1_enable" -} - -trap exit EXIT INT - -bail() { - echo "Error: $@" >&2 - echo "Exiting..." >&2 - exit 1 -} - -if ! [ -d "$HWMON" ]; then - bail "Invalid HWMON" -fi - -TEMP_INPUT="$HWMON/temp2_input" - -if ! [ -f $TEMP_INPUT ]; then - bail "Invalid TEMP_INPUT" -fi - -TEMP_MIN="$2" -TEMP_MAX="$3" - -if [ -z "$TEMP_MIN" ];then - bail "No minimum temperature provided" -fi - -if [ -z "$TEMP_MAX" ];then - bail "No maximum temperature provided" -fi - -PWM_MIN=0 -PWM_MAX=255 - -echo "Running..." >&2 -while true; do - TEMPERATURE_RAW=$(cat "$TEMP_INPUT") - TEMPERATURE="$(( $TEMPERATURE_RAW / 1000 ))" - # Remap from a number between 60_000..90_000 to 0..255 - PWM=$(( ($TEMPERATURE - $TEMP_MIN) * $PWM_MAX / ($TEMP_MAX - $TEMP_MIN) )) - - if [ "$PWM" -gt $PWM_MAX ]; then - PWM=$PWM_MAX - elif [ "$PWM" -lt $PWM_MIN ]; then - PWM=$PWM_MIN - fi - - echo 1 > "$HWMON/pwm1_enable" - echo "$PWM" > "$HWMON/pwm1" - sleep .1s -done diff --git a/scripts/default.nix b/scripts/default.nix index c2725ee..78ccac8 100644 --- a/scripts/default.nix +++ b/scripts/default.nix @@ -23,7 +23,6 @@ in with final; createScripts { - amd-fan-control = [ bash ]; br = [ ]; bmenu = [ bemenu