cemkaya-mpi / Dell-G15-Controller

GNU General Public License v3.0
36 stars 14 forks source link

dell g15 5530 #17

Open MouseRun opened 6 months ago

MouseRun commented 6 months ago

Does this project support the Dell G15 5530?

cemkaya-mpi commented 6 months ago

Hello, not yet. If you have a 5530, could you share the output of the following?

#!/bin/bash

c(){ echo "$1" | sudo tee /proc/acpi/call >/dev/null && sudo cat /proc/acpi/call;echo;}

for mode in 0xa{0..9} 0xa{a..b}
do
    echo "Trying mode ${mode}"
    echo "\_SB.AMWW.WMAX 0 0x15 {0x01, ${mode}, 0x00, 0x00}"
    c "\_SB.AMWW.WMAX 0 0x15 {0x01, ${mode}, 0x00, 0x00}"
done
echo "Reverting to balanced."
c "\_SB.AMWW.WMAX 0 0x15 {0x01, 0xa0, 0x00, 0x00}"

You could also try replacing AMWW with AMW3 and try again if there are no zeros in the results.

meduk0 commented 6 months ago

well i have this model and wanna share the result :

Trying mode 0xa0
\_SB.AMWW.WMAX 0 0x15 {0x01, 0xa0, 0x00, 0x00}
[sudo] password for meduko: 
0x0
Trying mode 0xa1
\_SB.AMWW.WMAX 0 0x15 {0x01, 0xa1, 0x00, 0x00}
0x0
Trying mode 0xa2
\_SB.AMWW.WMAX 0 0x15 {0x01, 0xa2, 0x00, 0x00}
0xffffffff
Trying mode 0xa3
\_SB.AMWW.WMAX 0 0x15 {0x01, 0xa3, 0x00, 0x00}
0x0
Trying mode 0xa4
\_SB.AMWW.WMAX 0 0x15 {0x01, 0xa4, 0x00, 0x00}
0xffffffff
Trying mode 0xa5
\_SB.AMWW.WMAX 0 0x15 {0x01, 0xa5, 0x00, 0x00}
0x0
Trying mode 0xa6
\_SB.AMWW.WMAX 0 0x15 {0x01, 0xa6, 0x00, 0x00}
0xffffffff
Trying mode 0xa7
\_SB.AMWW.WMAX 0 0x15 {0x01, 0xa7, 0x00, 0x00}
0xffffffff
Trying mode 0xa8
\_SB.AMWW.WMAX 0 0x15 {0x01, 0xa8, 0x00, 0x00}
0xffffffff
Trying mode 0xa9
\_SB.AMWW.WMAX 0 0x15 {0x01, 0xa9, 0x00, 0x00}
0xffffffff
Trying mode 0xaa
\_SB.AMWW.WMAX 0 0x15 {0x01, 0xaa, 0x00, 0x00}
0xffffffff
Trying mode 0xab
\_SB.AMWW.WMAX 0 0x15 {0x01, 0xab, 0x00, 0x00}
0x0
Reverting to balanced.
0x0

NOTE : the version i have is an i5 13450hx and rtx 3050 with a while backlight keyboard i personnally poweroff entirely my dgpu when working so just configuring the fan speed is still my only problem (as it can be a pain sometimes )

cemkaya-mpi commented 6 months ago

Good. The zeros give me the list of supported power modes. Could you also share the result of

c "\_SB.AMWW.WMAX 0 0x1a {0x02, 0xa02, 0x00, 0x00}"

meduk0 commented 6 months ago

@cemkaya-mpi it is : 0x0 from what i understand :
0xa0: Balanced mode 0xa1: Performance mode 0xa2: Cool mode (seems to be unsupported you even commented it in main.py) 0xa3: Quiet mode 0xa4: Full Speed mode 0xa5: Battery Saver mode 0xa6 to 0xab: Results seem to be consistent with unsupported from my model
btw the bios offer 4 modes (quiet , battery , balanced and performance ) and the AWC offer battery quiet balanced and G mode for the keyboard my version only have white backlight which is easy to take care of (as i can controll it with a 4 lines bash script in hypr )

cemkaya-mpi commented 5 months ago

Well, if this returns 0, we need another way of finding out that the device is a 5530. On other models, this command returns the laptop model so that the correct acpi calls can be chosen.

Could you share your dsdt?

Dias-Gabs commented 5 months ago

Hey bro, I'm almost going mad because, once again, I can't stand Windows. I have a Dell G15 5530 i7 13gen, RTX 3050 6Gb. Is there any chance of at least being able to turn on the fans? The Dell g15 gets very hot even with the Alienware OC controls in use, imagine without...

Result of the commands you requested:

done echo "Reverting to balanced." c "_SB.AMWW.WMAX 0 0x15 {0x01, 0xa0, 0x00, 0x00}" Trying mode 0xa0 _SB.AMWW.WMAX 0 0x15 {0x01, 0xa0, 0x00, 0x00} tee: /proc/acpi/call: No such file or directory

Trying mode 0xa1 _SB.AMWW.WMAX 0 0x15 {0x01, 0xa1, 0x00, 0x00} tee: /proc/acpi/call: No such file or directory

Trying mode 0xa2 _SB.AMWW.WMAX 0 0x15 {0x01, 0xa2, 0x00, 0x00} tee: /proc/acpi/call: No such file or directory

Trying mode 0xa3 _SB.AMWW.WMAX 0 0x15 {0x01, 0xa3, 0x00, 0x00} tee: /proc/acpi/call: No such file or directory

Trying mode 0xa4 _SB.AMWW.WMAX 0 0x15 {0x01, 0xa4, 0x00, 0x00} tee: /proc/acpi/call: No such file or directory

Trying mode 0xa5 _SB.AMWW.WMAX 0 0x15 {0x01, 0xa5, 0x00, 0x00} tee: /proc/acpi/call: No such file or directory

Trying mode 0xa6 _SB.AMWW.WMAX 0 0x15 {0x01, 0xa6, 0x00, 0x00} tee: /proc/acpi/call: No such file or directory

Trying mode 0xa7 _SB.AMWW.WMAX 0 0x15 {0x01, 0xa7, 0x00, 0x00} tee: /proc/acpi/call: No such file or directory

Trying mode 0xa8 _SB.AMWW.WMAX 0 0x15 {0x01, 0xa8, 0x00, 0x00} tee: /proc/acpi/call: No such file or directory

Trying mode 0xa9 _SB.AMWW.WMAX 0 0x15 {0x01, 0xa9, 0x00, 0x00} tee: /proc/acpi/call: No such file or directory

Trying mode 0xaa _SB.AMWW.WMAX 0 0x15 {0x01, 0xaa, 0x00, 0x00} tee: /proc/acpi/call: No such file or directory

Trying mode 0xab _SB.AMWW.WMAX 0 0x15 {0x01, 0xab, 0x00, 0x00} tee: /proc/acpi/call: No such file or directory

Reverting to balanced. tee: /proc/acpi/call: No such file or directory

Last one: c "_SB.AMWW.WMAX 0 0x1a {0x02, 0xa02, 0x00, 0x00}" tee: /proc/acpi/call: No such file or directory

meduk0 commented 5 months ago

@Dias-Gabs install acpi my bro sudo pacman -S acpi (for more info check the arch wiki ) @cemkaya-mpi sorry for late response . sudo dmesg | grep DSDT gives : [ 0.008939] ACPI: DSDT 0x0000000061748000 09F811 (v02 DELL Dell Inc 00000002 01000013) [ 0.009044] ACPI: Reserving DSDT table memory at [mem 0x61748000-0x617e7810] [ 0.371248] ACPI: \_SB_.PC00.LPCB.ECDV: Boot DSDT EC used to handle transactions [ 1.263432] ACPI: \_SB_.PC00.LPCB.ECDV: Boot DSDT EC initialization complete

cemkaya-mpi commented 5 months ago

Hi, the following command(s)

c "\_SB.AMWW.WMAX 0 0x1a {0x02, 0xa02, 0x00, 0x00}"
c "\_SB.AMW3.WMAX 0 0x1a {0x02, 0xa02, 0x00, 0x00}"

are used in other G15 models to determine the laptop model. It should return the laptop model number for the 5530, which is used to determine the correct acpi calls. In case both of the above return 0 or an error for both of you, I need to use another way to determine that the current laptop is the 5530. Could you please share the whole dump of the dsdt, and not just sudo dmesg | grep DSDT ? The procedure can be found here.

Dias-Gabs commented 5 months ago

I managed to manipulate the fans in Fedora, but unfortunately not with your app. I made a brief .py to run and added it via command. But I ended up having some major problems with Fedora and didn't get used to it. I'm not very experienced with Linux, but I've used Ubuntu on my desktop before, so I went for it. But this is the first time I've used Linux on a laptop that has controllable fans.

Sorry if I'm not being very helpful, but I understand that the commands are different for each model of laptop, so they should work on Ubuntu too since I haven't changed my laptop model, right?... But every time I try to use the same commands that worked on Fedora, I get an ‘Invalid Argument’. I even tried to understand a bit more about the ACPI, but I don't have the knowledge to risk testing anything. If you need any more specific help, I'm happy to help. I don't know if different arguments should be used for each Linux distro, but if there is something I'd love to test. I just wanted to be able to work and play without windows consuming almost all my RAM, and without my dell catching fire in Linux lol.

I got the DSDTs dump (dsdt.dat & dsdt.dsl) and they are ok, but i'm not being able to upload/send it, not even PasteBin or others. I also tried copying to a .txt but didn't work. I can perfectly read these files, but It seems they won't leave my pc lol. I will try something else soon.

The result of the last two commands you asked for was also Invalid Argument. But well... I'm sure mine is the 5530. c "_SB.AMWW.WMAX 0 0x1a {0x02, 0xa02, 0x00, 0x00}" c "_SB.AMW3.WMAX 0 0x1a {0x02, 0xa02, 0x00, 0x00}"

Worked on Fedora: " echo "- Testing mode: 0xa0" echo "_SB.AMWW.WMAX 0 0x15 {0x01, 0xa0, 0x00, 0x00}" | sudo tee /proc/acpi/call && sudo cat /proc/acpi/call

echo "- Testing mode: 0xa1" echo "_SB.AMWW.WMAX 0 0x15 {0x01, 0xa1, 0x00, 0x00}" | sudo tee /proc/acpi/call && sudo cat /proc/acpi/call

echo "- Testing mode: 0xa3" echo "_SB.AMWW.WMAX 0 0x15 {0x01, 0xa3, 0x00, 0x00}" | sudo tee /proc/acpi/call && sudo cat /proc/acpi/call

echo "- Testing mode: 0xa5" echo "_SB.AMWW.WMAX 0 0x15 {0x01, 0xa5, 0x00, 0x00}" | sudo tee /proc/acpi/call && sudo cat /proc/acpi/call

echo "- Testing mode: 0xab" echo "_SB.AMWW.WMAX 0 0x15 {0x01, 0xab, 0x00, 0x00}" | sudo tee /proc/acpi/call && sudo cat /proc/acpi/call "

Ubuntu result: " root@dias-Dell-G15-5530:~# #!/bin/bash

c(){ echo "$1" | sudo tee /proc/acpi/call >/dev/null && sudo cat /proc/acpi/call;echo;}

for mode in 0xa{0..9} 0xa{a..b} do echo "Trying mode ${mode}" echo "_SB.AMWW.WMAX 0 0x15 {0x01, ${mode}, 0x00, 0x00}" c "_SB.AMWW.WMAX 0 0x15 {0x01, ${mode}, 0x00, 0x00}" done echo "Reverting to balanced." c "_SB.AMWW.WMAX 0 0x15 {0x01, 0xa0, 0x00, 0x00}" Trying mode 0xa0 _SB.AMWW.WMAX 0 0x15 {0x01, 0xa0, 0x00, 0x00} tee: /proc/acpi/call: Invalid argument

Trying mode 0xa1 _SB.AMWW.WMAX 0 0x15 {0x01, 0xa1, 0x00, 0x00} tee: /proc/acpi/call: Invalid argument

Trying mode 0xa2 _SB.AMWW.WMAX 0 0x15 {0x01, 0xa2, 0x00, 0x00} tee: /proc/acpi/call: Invalid argument

Trying mode 0xa3 _SB.AMWW.WMAX 0 0x15 {0x01, 0xa3, 0x00, 0x00} tee: /proc/acpi/call: Invalid argument

Trying mode 0xa4 _SB.AMWW.WMAX 0 0x15 {0x01, 0xa4, 0x00, 0x00} tee: /proc/acpi/call: Invalid argument

Trying mode 0xa5 _SB.AMWW.WMAX 0 0x15 {0x01, 0xa5, 0x00, 0x00} tee: /proc/acpi/call: Invalid argument

Trying mode 0xa6 _SB.AMWW.WMAX 0 0x15 {0x01, 0xa6, 0x00, 0x00} tee: /proc/acpi/call: Invalid argument

Trying mode 0xa7 _SB.AMWW.WMAX 0 0x15 {0x01, 0xa7, 0x00, 0x00} tee: /proc/acpi/call: Invalid argument

Trying mode 0xa8 _SB.AMWW.WMAX 0 0x15 {0x01, 0xa8, 0x00, 0x00} tee: /proc/acpi/call: Invalid argument

Trying mode 0xa9 _SB.AMWW.WMAX 0 0x15 {0x01, 0xa9, 0x00, 0x00} tee: /proc/acpi/call: Invalid argument

Trying mode 0xaa _SB.AMWW.WMAX 0 0x15 {0x01, 0xaa, 0x00, 0x00} tee: /proc/acpi/call: Invalid argument

Trying mode 0xab _SB.AMWW.WMAX 0 0x15 {0x01, 0xab, 0x00, 0x00} tee: /proc/acpi/call: Invalid argument

Reverting to balanced. tee: /proc/acpi/call: Invalid argument "

meduk0 commented 5 months ago

@Dias-Gabs i don't use ubunto (never did the most close i got was debian for 2 years )make sure you have acpi installed in your system (it might be the reason for tee: /proc/acpi/call: Invalid argument ) i don't know about your version of the laptop (mine i5 13450hx rtx 3050 ) but i figured out how to conrol the fans https://wiki.archlinux.org/title/fan_speed_control#Dell_laptops
you can contact me if you need some help :)

cemkaya-mpi commented 5 months ago

Yes, acpi_call module is a dependency and should be installed from ubuntu repositories.

Since both laptop model calls

c "\_SB.AMWW.WMAX 0 0x1a {0x02, 0xa02, 0x00, 0x00}"
c "\_SB.AMW3.WMAX 0 0x1a  {0x02, 0xa02, 0x00, 0x00}"

return 0, the call might be different for the 5530, which is why I need the dsdt to check which acpi call has to be made.

cemkaya-mpi commented 4 months ago

Any progress with dsdt.dsl?

meduk0 commented 4 months ago

for me nah i just found out my way (thx for the inspiration and the info i was able to make the necessary changes ) i guess i will close the issue @Dias-Gabs plz confirm

meduk0 commented 3 months ago

@cemkaya-mpi can we end this by getting the 5530 added to the list of compatible devices :)

cemkaya-mpi commented 2 months ago

Does the app work for 5530 as is? I thought it did not.

meduk0 commented 2 months ago

it did not i use cctk for now (get the job done ) no problem for now . i even went to make a systemd service that monitor my temps and adjust the fans profiles according to the presence of ac and temps thx anyways . I really appreciate if you share some resources about acpi_calls (i might need them in the future and in case i found a solution i will share it)

meduk0 commented 2 months ago

also someone at reddit shared this for his zshrc config function but it won't work with my model (he is using a 5510) . It might be useful :)

gmode() {
    local hwmon_dir
    local pwm1_path
    local pwm2_path
    local max_speed=255
    local half_speed=128
    hwmon_dir=$(grep -l "dell_smm" /sys/class/hwmon/hwmon*/name | xargs -I {} dirname {})

    if [ -z "$hwmon_dir" ]; then
        echo "Could not find the hwmon directory with 'dell_smm'."
        return 1
    fi

    pwm1_path="$hwmon_dir/pwm1"
    pwm2_path="$hwmon_dir/pwm2"

    case "$1" in
        on)
            echo $max_speed | sudo tee $pwm1_path $pwm2_path > /dev/null
            echo "Fans set to maximum."
            ;;
        off)
            echo $half_speed | sudo tee $pwm1_path $pwm2_path > /dev/null
            echo "Fans set to 50%."
            ;;
        *)
            echo "Usage: gmode [on | off]"
            ;;
    esac
}
cemkaya-mpi commented 2 months ago

Yes from hwmon, it is possible to set the fan speed to 0%, 50% and 100%. However, you may damage your hardware if your script is unresponsive for whatever reason.

As mentioned before, I already have the list of supported modes from this thread. However, I still need the output of

c "\_SB.AMWW.WMAX 0 0x1a {0x02, 0xa02, 0x00, 0x00}"
c "\_SB.AMW3.WMAX 0 0x1a  {0x02, 0xa02, 0x00, 0x00}"

and probably a dsdt.dsl file to add support for the 5530.

meduk0 commented 2 months ago

sorry for late response :) so i tried both of them them c "\_SB.AMWW.WMAX 0 0x1a {0x02, 0xa02, 0x00, 0x00}" -> 0x0 c "\_SB.AMW3.WMAX 0 0x1a {0x02, 0xa02, 0x00, 0x00}" -> Error: AE_NOT_FOUND which is wired (don't get me wrong but i don't understand those things (especially acpi_calls ) (i use acpi_dkms on a custum arch linux kernel ) this is the dsdt.dat (dsdt.dat)

cemkaya-mpi commented 2 months ago

Please try the G15 5530 branch. If it works, I will merge.

meduk0 commented 2 months ago

i am trying it (i just need to reboot for the acpi_call to take action )

meduk0 commented 2 months ago

nah it won't :

Invalid value (0) for DRI_PRIME. Should be > 0
Traceback (most recent call last):
  File "/home/meduko/Dell-G15-Controller/main.py", line 470, in <module>
    window = MainWindow()
             ^^^^^^^^^^^^
  File "/home/meduko/Dell-G15-Controller/main.py", line 27, in __init__
    self.init_acpi_call()
  File "/home/meduko/Dell-G15-Controller/main.py", line 90, in init_acpi_call
    if self.is_dell_g15:
       ^^^^^^^^^^^^^^^^
AttributeError: 'MainWindow' object has no attribute 'is_dell_g15'

there are alot fo problems with the main.py (even pyrigth indicate 35 errors with this commit ) : the dell_init is not working ( `` echo \"\_SB.AMW3.WMAX 0 {} {{{}, {}, {}, 0x00}}\" |sudo tee /proc/acpi/call ; sudo cat /proc/acpi/call

"_SB.AMW3.WMAX 0 {} {{}}" { {}}" { {}}" { 0x00}" Error: AE_BAD_PARAMETER⏎ `) and the qt interface is neither working with this commit nor the aur pkg . Also to make thing easier , lm_sensors indicate both cpu and gpu temps and fans speed after adding (sudo modprobe dell_smm_hwmon`) which will make working on this project easier as dell provide them . image

i will try to debug the code and find solutions for the issues

meduk0 commented 2 months ago

i also want to add that dell provide a cli tool to manage thermal management which work out of the box with almost any dell laptop (which will make thing much ez as we only need just the acpi call for the the turbo mode

╰─λ sudo cctk -H --ThermalManagement                              fish-1 | 0 (0.021s) < 22:41:21

ThermalManagement:  This setting helps in cooling the fan and the processor to improve system performance by reducing noise and temperature.

Arguments: Optimized+ | Cool+ | Quiet+ | UltraPerformance+

Note : + Indicates the arguments supported in the current machine.

the pkg is available cctk Don't get me wrong i don't wont this project to die but we can make things much more ez (especially with what little dell provides ) and focus on the harder stuff

cemkaya-mpi commented 2 months ago

Probably need to change 0x0 to 0x00 in main.py line 101. I would rather not add another dependency to the project.

Could you check what value is returned in line 100? If not, I will change 0x0 to 0x00 and you can try again later.

cemkaya-mpi commented 2 months ago

Any progress? There should also be a log file at "/tmp/dellg15controller.log.

meduk0 commented 2 months ago

no progress . i think i need to change alot because the echo value >> location never worked for me at all . I always use the echo value | sudo tee location , it should take some times to make those changes :) and other than the check for the laptop model is not working neither on the aur build nor on the G15 5530 branch . Can you plz explain to me the acpi_calls , i can debug the problem by myself and find a solution then i will make a git commit to this project . the turbo mux switch is the most important thing in this project for me as i have no color backlight (just white ) and the other modes works fantastic with the dell cctk . I found this project which can help us as it provides the essentials for the support for all the 55** laptops tcc-g15

cemkaya-mpi commented 2 months ago

After the laptop model check fails, nothing will work anyway. Changing the acpi call strings in checkLaptopModel() and adding tee is all that is needed then.

tr1xem commented 3 weeks ago

I bought dell g15 5530 too whats the progress? where is it stuck on? any way i can help in development?

@meduk0 would be grateful if you can help me get through controling fans and lights on arch Lets make it work with g15 5530

Dell G15 i713650HX RTX 3050 6gb 4 zone rgb

tr1xem commented 3 weeks ago

@cemkaya-mpi What about lights ? how can i configure them for 5530?

tr1xem commented 3 weeks ago

@meduk0 can you share ur script? for g15 5530

cemkaya-mpi commented 3 weeks ago

@tr1xem keyboard lights should work if the keyboard is the same as G15 5525. Please check with lsusb.

Likely the self.acpi_cmd has to be changed, since others report that cat /proc/acpi does not work for them. It is only a couple lines that have to be changed, but I have not found the time to do this yet. See my comment on Sep 23. There is a 5530 branch that you can test and make the changes. PRs are welcome.

tr1xem commented 3 weeks ago

What should lsusb return ?

I got 4 zone rgb keyboard tho

cemkaya-mpi commented 3 weeks ago

Read the readme.

tr1xem commented 3 weeks ago

I have found the cmds should i edit and impliment them and make a pr or give cmds to you?

tr1xem commented 3 weeks ago

Bus 001 Device 003: ID 187c:0551 Alienware Corporation AW-ELC

A diff model

cemkaya-mpi commented 3 weeks ago

A PR would be welcome for the acpi commands. Otherwise I will probably do it around Christmas.

For the keyboard with the different model, things likely will not work as is. You could experiment with awelc.py and elc.py to get things working, but you might brick your keyboard backlights. It might also just be the zones.

Instead, you could start by sniffing the USB communication from windows using AWCC, simple commands such as backlight on, backight off and so on, and reconstructing the same messages here.

tr1xem commented 3 weeks ago

How could i do so? that sniffing thing

Also it would be help full if you can give requirements.txt and would be help full if u can tell where to set cmds?

tr1xem commented 3 weeks ago

For Refrence

"_SB.AMWW.WMAX 0 0x15 {1, 0xa0, 0x00, 0x00}" > /proc/acpi/call"

^ its for balance mode

tr1xem commented 3 weeks ago

and also we can do this too

"echo powersave > /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor" Like for g mode and powersaving

cemkaya-mpi commented 3 weeks ago

That sets the cpu frequency scaling governor. Requirements are listed in the readme and the AUR package.

meduk0 commented 3 weeks ago

finally someone that have the same laptop . Personnally , i use the cctk provided by dell to manage all bios settings it is kind slow but if you just wonna switch modes waiting two seconds is not that bad (max is balanced , i tried the gmod on linux and i cause the graphic card driver to go nuts (nividia-open is made to dynamically manage power which is the opposite of the gmode (it force the gpu to be always 100 percent ) ) for the keyboard , i have the white backlight it works directly with any tool available on linux ( check it )
for this tool i am already done working with it , so many errors + i am working on a systemd service for gaming ( it might take a while to release it as i don't game that often this days and even i don't use this laptop as my daily driver anymore ) But i can help

meduk0 commented 3 weeks ago

@tr1xem you can try some of my own scripts

#!/bin/bash
#thermal_mode=$(sudo cctk --ThermalManagement | cut -d "=" -f2)
fans_speed=$(sensors | awk '/fan1/ {print $2}')
if [ $fans_speed != 0 ] ; then
    echo "cctk:     cool "
    cctk --ThermalManagement=Cool # dell's one
fi
#echo 15 |tee  /sys/devices/system/cpu/cpu*/power/energy_perf_bias #old
cpupower -c all set --perf-bias 15
cpupower -c 0-11 frequency-set -d 0.8GHz -u 1.2GHz
cpupower -c 12-15 frequency-set -d 0.8GHz -u 1GHz
#echo powersupersave | tee /sys/module/pcie_aspm/parameters/policy
#echo 5  |tee  /proc/sys/vm/laptop_mode #for hdds
current_scheduler=$(grep "^SCX_SCHEDULER=" "/etc/default/scx" | cut -d'=' -f2)
current_flags=$(grep "^SCX_FLAGS=" "/etc/default/scx" | cut -d'=' -f2 | xargs)
new_scheduler="scx_lavd"
new_flags="--powersave "
if [ "$new_flags" != "$current_flags" ]; then
    echo "lavd :powersave "
    sed -i -e "s/^SCX_SCHEDULER=.*/SCX_SCHEDULER=$new_scheduler/" \
        -e "s/^SCX_FLAGS=.*/SCX_FLAGS=\"$new_flags\"/" "/etc/default/scx"
    systemctl restart scx
else
    echo "lavd powersave already set ! "
fi

#made for the systemd service
echo "[custom] :powersave mode enabled " | tee /dev/kmsg 

you can add it to /usr/bin and use it as a systemd service when launching the laptop Note this script use around 20mb of ram and 200ms while booting it will help alot especially with battery life and thermal as what i found that the hx processors really don't need the extra juice of turbo boost to function . Also , capping the battery is a neccesity (dell's adaptive mode is a fucking joke )

# /etc/systemd/system/powersave.service
[Unit]
Description=powersave config :<

[Service]
ExecStart=/usr/bin/powersave
User=root

[Install]
WantedBy=graphical.target

Now for the power stuff , most games that runs on linux doesn't need turboboost so keeping the laptop from frying itself is a better idea

#!/bin/bash
if [ "$(id -u)" -ne 0 ]; then
    echo "This script must be run as root."
    exit 1
fi
cctk --ThermalManagement=UltraPerformance
tlp ac
cpupower -c 0-11 frequency-set -d 1.2GHz -u 2.4GHz
cpupower -c 12-15 frequency-set -d 0.8GHz -u 1.8GHz
cpupower -c all frequency-set -g performance
cpupower -c all set --perf-bias 0
#echo performance | tee /sys/module/pcie_aspm/parameters/policy
echo "lavd :performance "
current_scheduler=$(grep "^SCX_SCHEDULER=" "/etc/default/scx" | cut -d'=' -f2)
current_flags=$(grep "^SCX_FLAGS=" "/etc/default/scx" | cut -d'=' -f2)
new_scheduler="scx_lavd"
new_flags="--performance "
 sed -i -e "s/^SCX_SCHEDULER=.*/SCX_SCHEDULER=$new_scheduler/" \
        -e "s/^SCX_FLAGS=.*/SCX_FLAGS=\"$new_flags\"/" "/etc/default/scx"
systemctl restart scx

note i use arch linux so if u use the latest kernel it should come with scx_sched as cpu governor which can be a game changer if you ask me . otherwise , the rest come as the linux coreutils so no installation needed . I don't use this github that often you can ping me in any time i will answer . And as what i mention before there is no need to use the G mode as it cause more trouble than what it offers final note : #plz_don't_buy_dell

cemkaya-mpi commented 3 weeks ago

@tr1xem please try the G15_5530 branch. If it does not work, upload /tmp/dellg15controller.log. I have changed the acpi call command since others have reported that the current one never worked for them.

Again: if you set fan speeds manually with hwmon to a slower rpm than needed, you will either damage your laptop, or trigger nvidia driver power limit to 45W. cctk looks like a much better alternative, though I have not tried it.

tr1xem commented 2 weeks ago

@meduk0 Thanks for the scripts @cemkaya-mpi I would do that once i get my laptop back from service centre How can a laptop have issue in 4 days itself? #dont_buy_dell

Also is the G15_5530 Branch is safe? I used only acpi calls would it damage?

Also

        notify_send('Activating GMode\nActivating performance cpu governer')
        executeAcpiCall('echo "\\_SB.AMWW.WMAX 0 0x15 {1, 0xab, 0x00, 0x00}" > /proc/acpi/call')
        executeAcpiCall('echo "\\_SB.AMWW.WMAX 0 0x25 {1, 0x01, 0x00, 0x00}" > /proc/acpi/call')

This is how gmode works for me

tr1xem commented 2 weeks ago

@meduk0 And for the reference I use arch too CachyOS default kernel (SCHED-EXT) BPF extensible scheduler class + BORE Scheduler - linux-cachyos ^ My kernel so would not be a issue

I had some questions

The First script is about powersave right? I generally use it plugged it so it detect that too ?

And for the second script when should it run? Also i see we have limit the cpu to 2.4 Hz but ig we can do it upto like 4.9( alteast for me i7 13650HX) why not that (just curious is it for power saving or thermal management) Games for refrence: GTA V FAR CRY etc etc

And last The sched ext thing how can we implement it?

And We can connect on some other platform if you can?

meduk0 commented 2 weeks ago

so i will try to answer all your question . I use cachyos too , i am active in teir discord you can ping me and i will answer when i can . Let's start , you can add the option to check if power is plugged or not in the first if statement in powerssave mode , but i personnaly advice you to use it always as it keeps your laptop is good temps and you can even use a usb-c charger (i do with a 100w belkin one as the original one is like half a kilogram and the belkin one is even enough for my gaming need's ) . For the second script it is for general heavy computing tasks that need power and make temps go high usually like gaming or using a lot fo containers (a typical software engineer environment ) it only set the cpu to it's capaiblities and control the powermanagement to let your gpu use the needed power (as the open nvidia driver use dynamic power management in linux as what i mentionned before ) . As i said before turbo boost doesn't affect videogames performance that much especially non fps competitive games especially as intel blocks undervolting even on hx processors . I guess the health of your laptop matter the most , if you ask me for my opinion if you can go with a legion laptop go for it especially the amd one (especially as they are better maintained in cachyos ) , dell is a shitty campany , i f you can't make sure to update the nvidia firmware (this as it is remove's most of the problem with the hardware . well for the sched_ext , as you use cachyos , ptr and the team does a great job at being an early adopter (so you can use it directly no added steps , try the provided algorithms for sched_ext to find what fit your needs the better ) For more info contact me on discord (my username is meduk0 ) or ping me or the cachyos discord and i will answer you when i can ( usually check every night ) . Again , if you afford to get a better laptop that is not dell go for it . For now let's stop poluting this github repo

meduk0 commented 2 weeks ago

@tr1xem sorry for the long response . Hopefully you have enough brain cells to read it . AS what i told you better contact me on discord I can help you at anything

tr1xem commented 2 weeks ago

@cemkaya-mpi I would work on the script asap (The laptop still is in repariment)

@meduk0 thanks for the explanation i have sent u a request too Ngl I did a mistake buying it been 4 days i bought the laptop and its already damaged Its motherboard got some fault now the company is saying to replace the item I cant just change the laptop guess had to live with it I totally understood what you said i would reply on discord

Sorry for polluting this issue :3