#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2024 ArchR (https://github.com/archr-linux/Arch-R)

# Minimal OS variable loading for performance
. /etc/profile.d/001-functions

if [ -z "${GPU_FREQ}" ]; then
  . /etc/profile
fi

# Set max gpu freq
case $1 in
  disable)
    echo 834000000 > $GPU_FREQ/max_freq
    set_setting enable.gpu-overclock 0
  ;;
  enable)
    echo 1050000000 > $GPU_FREQ/max_freq
    set_setting enable.gpu-overclock 1
  ;;
esac
