Skip to content

Instantly share code, notes, and snippets.

@Mnkai
Last active August 30, 2018 16:09

Revisions

  1. Mnkai revised this gist Mar 18, 2018. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions undervolt-sleep.service
    Original file line number Diff line number Diff line change
    @@ -1,10 +1,10 @@
    [Unit]
    Description=Undervolting preset resume after sleep
    Before=sleep.target
    After=suspend.target

    [Service]
    Type=oneshot
    ExecStop=/bin/bash /opt/undervolt_check_and_apply.sh
    ExecStart=/bin/bash /opt/undervolt_check_and_apply.sh

    [Install]
    WantedBy=sleep.target
    WantedBy=suspend.target
  2. Mnkai revised this gist Feb 4, 2018. 1 changed file with 10 additions and 10 deletions.
    20 changes: 10 additions & 10 deletions undervolt_check_and_apply.sh
    Original file line number Diff line number Diff line change
    @@ -3,26 +3,26 @@
    # Check for core offset
    wrmsr 0x150 0x8000001000000000
    if [ $(rdmsr 0x150) == "0" ]; then
    wrmsr 0x150 0x80000011f1400000 # -0.1152V
    echo "Core offset set!"
    wrmsr 0x150 0x80000011f2800000 # -0.1055V
    echo "Core offset set!"
    else
    echo "Core offset is already set!"
    echo "Core offset is already set!"
    fi

    # Check for GPU offset
    wrmsr 0x150 0x8000011000000000
    if [ $(rdmsr 0x150) == "0" ]; then
    wrmsr 0x150 0x80000111f9a00000 # -0.0498V
    echo "GPU offset set!"
    wrmsr 0x150 0x80000111f5c00000 # -0.0801V
    echo "GPU offset set!"
    else
    echo "GPU offset is already set!"
    echo "GPU offset is already set!"
    fi

    # Check for cache offset
    wrmsr 0x150 0x8000021000000000
    if [ $(rdmsr 0x150) == "0" ]; then
    wrmsr 0x150 0x80000211f1400000 # -0.1152V
    echo "Cache offset set!"
    wrmsr 0x150 0x80000211f2800000 # -0.1055V
    echo "Cache offset set!"
    else
    echo "Cache offset is already set!"
    fi
    echo "Cache offset is already set!"
    fi
  3. Mnkai revised this gist Nov 26, 2017. 2 changed files with 19 additions and 0 deletions.
    10 changes: 10 additions & 0 deletions undervolt-sleep.service
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,10 @@
    [Unit]
    Description=Undervolting preset resume after sleep
    Before=sleep.target

    [Service]
    Type=oneshot
    ExecStop=/bin/bash /opt/undervolt_check_and_apply.sh

    [Install]
    WantedBy=sleep.target
    9 changes: 9 additions & 0 deletions undervolt-start.service
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,9 @@
    [Unit]
    Description=Undervolting preset resume after startup

    [Service]
    Type=oneshot
    ExecStart=/bin/bash /opt/undervolt_check_and_apply.sh

    [Install]
    WantedBy=multi-user.target
  4. Mnkai created this gist Nov 26, 2017.
    28 changes: 28 additions & 0 deletions undervolt_check_and_apply.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,28 @@
    #!/bin/bash

    # Check for core offset
    wrmsr 0x150 0x8000001000000000
    if [ $(rdmsr 0x150) == "0" ]; then
    wrmsr 0x150 0x80000011f1400000 # -0.1152V
    echo "Core offset set!"
    else
    echo "Core offset is already set!"
    fi

    # Check for GPU offset
    wrmsr 0x150 0x8000011000000000
    if [ $(rdmsr 0x150) == "0" ]; then
    wrmsr 0x150 0x80000111f9a00000 # -0.0498V
    echo "GPU offset set!"
    else
    echo "GPU offset is already set!"
    fi

    # Check for cache offset
    wrmsr 0x150 0x8000021000000000
    if [ $(rdmsr 0x150) == "0" ]; then
    wrmsr 0x150 0x80000211f1400000 # -0.1152V
    echo "Cache offset set!"
    else
    echo "Cache offset is already set!"
    fi