Set CPU frequency not working

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Set CPU frequency not working

Jump to solution
904 Views
noahw
Contributor III

I am following directions on this page (https://docs.nxp.com/bundle/GUID-39A0A446-70E5-4ED7-A580-E7508B61A5F1/page/GUID-40BE9AD5-DF6B-4D99-A...) about switching CPU frequency by writing to a file in /sys.

When I try to run the command

echo 799999 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed

I see the following error:

-bash: echo: write error: Invalid argument

 

What am I doing wrong? I tried other values like 300000, and I also tried putting the value in quotes, using the -n flag for echo, etc. I used chmod to add write permission to scaling_setspeed. Is there something else I need to do?

0 Kudos
Reply
1 Solution
858 Views
June_Lu
NXP TechSupport
NXP TechSupport

In the default LSDK2108.

root@localhost:~# cd /sys/devices/system/cpu/cpu0/cpufreq

root@localhost:/sys/devices/system/cpu/cpu0/cpufreq# ls

affected_cpus     cpuinfo_max_freq  cpuinfo_transition_latency  scaling_available_frequencies  scaling_cur_freq  scaling_governor  scaling_min_freq  stats

cpuinfo_cur_freq  cpuinfo_min_freq  related_cpus                scaling_available_governors    scaling_driver    scaling_max_freq  scaling_setspeed

root@localhost:/sys/devices/system/cpu/cpu0/cpufreq# cat scaling_available_governors

ondemand userspace performance

root@localhost:/sys/devices/system/cpu/cpu0/cpufreq# echo userspace > scaling_governor

root@localhost:/sys/devices/system/cpu/cpu0/cpufreq# cat scaling_cur_freq

600000

root@localhost:/sys/devices/system/cpu/cpu0/cpufreq# cat scaling_available_frequencies

1500000 1200000 750000 600000 375000 300000

root@localhost:/sys/devices/system/cpu/cpu0/cpufreq# echo 750000 > scaling_setspeed

root@localhost:/sys/devices/system/cpu/cpu0/cpufreq# cat scaling_cur_freq

750000

View solution in original post

0 Kudos
Reply
3 Replies
859 Views
June_Lu
NXP TechSupport
NXP TechSupport

In the default LSDK2108.

root@localhost:~# cd /sys/devices/system/cpu/cpu0/cpufreq

root@localhost:/sys/devices/system/cpu/cpu0/cpufreq# ls

affected_cpus     cpuinfo_max_freq  cpuinfo_transition_latency  scaling_available_frequencies  scaling_cur_freq  scaling_governor  scaling_min_freq  stats

cpuinfo_cur_freq  cpuinfo_min_freq  related_cpus                scaling_available_governors    scaling_driver    scaling_max_freq  scaling_setspeed

root@localhost:/sys/devices/system/cpu/cpu0/cpufreq# cat scaling_available_governors

ondemand userspace performance

root@localhost:/sys/devices/system/cpu/cpu0/cpufreq# echo userspace > scaling_governor

root@localhost:/sys/devices/system/cpu/cpu0/cpufreq# cat scaling_cur_freq

600000

root@localhost:/sys/devices/system/cpu/cpu0/cpufreq# cat scaling_available_frequencies

1500000 1200000 750000 600000 375000 300000

root@localhost:/sys/devices/system/cpu/cpu0/cpufreq# echo 750000 > scaling_setspeed

root@localhost:/sys/devices/system/cpu/cpu0/cpufreq# cat scaling_cur_freq

750000

0 Kudos
Reply
888 Views
June_Lu
NXP TechSupport
NXP TechSupport

Please kindly share the MPU part number and SW version, thanks

0 Kudos
Reply
874 Views
noahw
Contributor III

@June_Lu This is the LS1028ARDB running LSDK 21.08, kernel 5.10.35.

0 Kudos
Reply
%3CLINGO-SUB%20id%3D%22lingo-sub-2075588%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ESet%20CPU%20frequency%20not%20working%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2075588%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EI%20am%20following%20directions%20on%20this%20page%20(%3CA%20href%3D%22https%3A%2F%2Fdocs.nxp.com%2Fbundle%2FGUID-39A0A446-70E5-4ED7-A580-E7508B61A5F1%2Fpage%2FGUID-40BE9AD5-DF6B-4D99-A3FB-5988A50DACA2.html%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.nxp.com%2Fbundle%2FGUID-39A0A446-70E5-4ED7-A580-E7508B61A5F1%2Fpage%2FGUID-40BE9AD5-DF6B-4D99-A3FB-5988A50DACA2.html%3C%2FA%3E)%20about%20switching%20CPU%20frequency%20by%20writing%20to%20a%20file%20in%20%2Fsys.%3C%2FP%3E%3CP%3EWhen%20I%20try%20to%20run%20the%20command%3C%2FP%3E%3CPRE%3Eecho%20799999%20%26gt%3B%20%2Fsys%2Fdevices%2Fsystem%2Fcpu%2Fcpu0%2Fcpufreq%2Fscaling_setspeed%3C%2FPRE%3E%3CP%3EI%20see%20the%20following%20error%3A%3C%2FP%3E%3CP%3E-bash%3A%20echo%3A%20write%20error%3A%20Invalid%20argument%3C%2FP%3E%3CBR%20%2F%3E%3CP%3EWhat%20am%20I%20doing%20wrong%3F%20I%20tried%20other%20values%20like%20300000%2C%20and%20I%20also%20tried%20putting%20the%20value%20in%20quotes%2C%20using%20the%20-n%20flag%20for%20echo%2C%20etc.%20I%20used%20chmod%20to%20add%20write%20permission%20to%20scaling_setspeed.%20Is%20there%20something%20else%20I%20need%20to%20do%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2077014%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20Set%20CPU%20frequency%20not%20working%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2077014%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EIn%20the%20default%20LSDK2108.%3C%2FP%3E%0A%3CP%3Eroot%40localhost%3A~%23%20cd%20%2Fsys%2Fdevices%2Fsystem%2Fcpu%2Fcpu0%2Fcpufreq%3C%2FP%3E%0A%3CP%3Eroot%40localhost%3A%2Fsys%2Fdevices%2Fsystem%2Fcpu%2Fcpu0%2Fcpufreq%23%20ls%3C%2FP%3E%0A%3CP%3Eaffected_cpus%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20cpuinfo_max_freq%26nbsp%3B%20cpuinfo_transition_latency%26nbsp%3B%20scaling_available_frequencies%26nbsp%3B%20scaling_cur_freq%26nbsp%3B%20scaling_governor%26nbsp%3B%20scaling_min_freq%26nbsp%3B%20stats%3C%2FP%3E%0A%3CP%3Ecpuinfo_cur_freq%26nbsp%3B%20cpuinfo_min_freq%26nbsp%3B%20related_cpus%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20scaling_available_governors%26nbsp%3B%26nbsp%3B%26nbsp%3B%20scaling_driver%26nbsp%3B%26nbsp%3B%26nbsp%3B%20scaling_max_freq%26nbsp%3B%20scaling_setspeed%3C%2FP%3E%0A%3CP%3Eroot%40localhost%3A%2Fsys%2Fdevices%2Fsystem%2Fcpu%2Fcpu0%2Fcpufreq%23%20cat%20scaling_available_governors%3C%2FP%3E%0A%3CP%3Eondemand%20userspace%20performance%3C%2FP%3E%0A%3CP%3Eroot%40localhost%3A%2Fsys%2Fdevices%2Fsystem%2Fcpu%2Fcpu0%2Fcpufreq%23%20echo%20userspace%20%26gt%3B%20scaling_governor%3C%2FP%3E%0A%3CP%3Eroot%40localhost%3A%2Fsys%2Fdevices%2Fsystem%2Fcpu%2Fcpu0%2Fcpufreq%23%20cat%20scaling_cur_freq%3C%2FP%3E%0A%3CP%3E600000%3C%2FP%3E%0A%3CP%3Eroot%40localhost%3A%2Fsys%2Fdevices%2Fsystem%2Fcpu%2Fcpu0%2Fcpufreq%23%20cat%20scaling_available_frequencies%3C%2FP%3E%0A%3CP%3E1500000%201200000%20750000%20600000%20375000%20300000%3C%2FP%3E%0A%3CP%3Eroot%40localhost%3A%2Fsys%2Fdevices%2Fsystem%2Fcpu%2Fcpu0%2Fcpufreq%23%20echo%20750000%20%26gt%3B%20scaling_setspeed%3C%2FP%3E%0A%3CP%3Eroot%40localhost%3A%2Fsys%2Fdevices%2Fsystem%2Fcpu%2Fcpu0%2Fcpufreq%23%20cat%20scaling_cur_freq%3C%2FP%3E%0A%3CP%3E750000%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2076361%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20Set%20CPU%20frequency%20not%20working%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2076361%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F204495%22%20target%3D%22_blank%22%3E%40June_Lu%3C%2FA%3E%26nbsp%3BThis%20is%20the%20LS1028ARDB%20running%20LSDK%2021.08%2C%20kernel%205.10.35.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2075769%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20Set%20CPU%20frequency%20not%20working%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2075769%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EPlease%20kindly%20share%20the%20MPU%20part%20number%20and%20SW%20version%2C%20thanks%3C%2FP%3E%3C%2FLINGO-BODY%3E