Device hint for hwpstate_intel AC/BAT states?

I use this in sysctl.conf:

Code:
dev.hwpstate_intel.0.epp=0

Which works to force max-CPU clocks, but I'd like to be able to set a different epp mode on battery and switch automatically between that on BATT and AC epp=0. On Linux I do it through udev.

Any suggestions? I'm thinking a device hint could do this?
 
I am using custom simple script with devd(8) for this:
Code:
#!/bin/sh

# CPU perfomance, hwpstate_intel(8)
case $1 in
    economy)
        epp_value="100"
        backlight 20
        service power_profile 0x00
        ;;
    balance)
        epp_value="50"
        backlight 50
        service power_profile 0x01
        ;;
    perfomance)
        epp_value="0"
        ;;
esac

# Set CPU cores to epp level
ncpu=`sysctl -n hw.ncpu`
for cpu in `seq 0 $((${ncpu} - 1))`
do
    sysctl -q dev.hwpstate_intel.${cpu}.epp=${epp_value}
done

devd configuration:
Code:
     notify 100 {
             match "system"                  "ACPI";
             match "subsystem"               "ACAD";
             match "notify"                  "0x00";
             action "/home/user/thinkpad-powersave economy";
     };
    
     notify 100 {
             match "system"                  "ACPI";
             match "subsystem"               "ACAD";
             match "notify"                  "0x01";
             action "/home/user/thinkpad-powersave balance";
     };
 
Back
Top