Skip to content

Commit

Permalink
Add current related stuff
Browse files Browse the repository at this point in the history
Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
  • Loading branch information
FlyGoat committed Feb 5, 2019
1 parent 0aff81e commit d5fee36
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 8 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ cmake_install.cmake
install_manifest.txt
compile_commands.json
CTestTestfile.cmake
./ryzenadj
18 changes: 12 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,18 @@ Options
-i, --info Show information (W.I.P.)
Settings
-a, --stapm-limit=<u32> Sustained power limit (10e-3 W)
-b, --fast-limit=<u32> Fast PPT power limit (10e-3 W)
-c, --slow-limit=<u32> Slow PPT power limit (10e-3 W)
-d, --slow-time=<u32> Slow PPT constant time
-e, --stapm-time=<u32> STAMP constant time
-f, --tctl-temp=<u32> Tctl temperature (℃)
-a, --stapm-limit=<u32> Sustained power limit (10e-3 W)
-b, --fast-limit=<u32> Fast PPT power limit (10e-3 W)
-c, --slow-limit=<u32> Slow PPT power limit (10e-3 W)
-d, --slow-time=<u32> Slow PPT constant time (ms)
-e, --stapm-time=<u32> STAMP constant time (ms)
-f, --tctl-temp=<u32> Tctl temperature (℃)
-g, --vrm-current=<u32> Vrm Current Limit (mA)
-j, --vrmsoc-current=<u32> Vrm SoC Current Limit (mA)
-k, --vrmmax-current=<u32> Vrm Maximum Current Limit (mA)
-l, --vrmsocmax-current=<u32> Vrm SoC Maximum Current Limit (mA)
-m, --psi0-current=<u32> PSI0 Current Limit (mA)
-n, --psi0soc-current=<u32> PSI0 SoC Current Limit (mA)
```

### demo
Expand Down
18 changes: 16 additions & 2 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ int main(int argc, const char **argv)
int err = 0;

uint32_t stapm_limit = 0, fast_limit = 0, slow_limit = 0, slow_time = 0, stapm_time = 0, tctl_temp = 0;
uint32_t vrm_current = 0, vrmsoc_current = 0, vrmmax_current = 0, vrmsocmax_current = 0, psi0_current = 0, psi0soc_current = 0;

struct argparse_option options[] = {
OPT_HELP(),
Expand All @@ -49,9 +50,15 @@ int main(int argc, const char **argv)
OPT_U32('a', "stapm-limit", &stapm_limit, "Sustained power limit (10e-3 W)"),
OPT_U32('b', "fast-limit", &fast_limit, "Fast PPT power limit (10e-3 W)"),
OPT_U32('c', "slow-limit", &slow_limit, "Slow PPT power limit (10e-3 W)"),
OPT_U32('d', "slow-time", &slow_time, "Slow PPT constant time"),
OPT_U32('e', "stapm-time", &stapm_time, "STAMP constant time"),
OPT_U32('d', "slow-time", &slow_time, "Slow PPT constant time (ms)"),
OPT_U32('e', "stapm-time", &stapm_time, "STAMP constant time (ms)"),
OPT_U32('f', "tctl-temp", &tctl_temp, "Tctl temperature (℃)"),
OPT_U32('g', "vrm-current", &vrm_current, "Vrm Current Limit (mA)"),
OPT_U32('j', "vrmsoc-current", &vrmsoc_current, "Vrm SoC Current Limit (mA)"),
OPT_U32('k', "vrmmax-current", &vrmmax_current, "Vrm Maximum Current Limit (mA)"),
OPT_U32('l', "vrmsocmax-current", &vrmsocmax_current, "Vrm SoC Maximum Current Limit (mA)"),
OPT_U32('m', "psi0-current", &psi0_current, "PSI0 Current Limit (mA)"),
OPT_U32('n', "psi0soc-current", &psi0soc_current, "PSI0 SoC Current Limit (mA)"),
OPT_END(),
};

Expand Down Expand Up @@ -83,13 +90,20 @@ int main(int argc, const char **argv)
err = -1;
goto out_err;
}
memset(args, 0, sizeof(*args));

_do_adjust(stapm_limit, 0x1a);
_do_adjust(fast_limit, 0x1b);
_do_adjust(slow_limit, 0x1c);
_do_adjust(slow_time, 0x1d);
_do_adjust(stapm_time, 0x1e);
_do_adjust(tctl_temp, 0x1f);
_do_adjust(vrm_current, 0x20);
_do_adjust(vrmsoc_current, 0x21);
_do_adjust(vrmmax_current, 0x22);
_do_adjust(vrmsocmax_current, 0x23);
_do_adjust(psi0_current, 0x24);
_do_adjust(psi0soc_current, 0x25);

out_err:
free(args);
Expand Down

0 comments on commit d5fee36

Please sign in to comment.