(if you are running windows)
you might want to check a tool called PBO2Tunner (https://www.cybermania.ws/apps/pbo2-tuner/), you can tweak values like EDC,TDC and PPT (power limit) from the GUI, and it also accepts command line commands so you can automate those tasks.
I made scripts that "cap" the power consumption of the cpu based on what applications are running. (i.e. only going all in on certain games, dynamically swaping between 65-90-120-180w handmade profiles)
i made with power saving in mind given the idle power consumption is rather high on modern ryzens.
edit: actually made a mistake given that PBO2Tunner is for Zen3 cpus, and you mentioned Zen4.