Hi there Kernel devs!
I need some help writing kernel code related to CPU temperature. I am a newbie kernel developer and I have already gone through the basics of driver development and also written a "hello world" driver.
Now, I am looking to up my game and I have assigned myself this project.
The fan will be connected to the GPIO pins. The fan should turn ON when the CPU temperature goes above a certain point. The fan will cool down the CPU and thereafter, when the temperature goes below a certain point, the fan should stop.
Now, I can easily write a python script of a C program in user space for that as the CPU temperature is written to a file "sys/class/hwmon/thermal/thermal_zone0/temp", but that won't help me understand writing the driver or making changes in the kernel. Hence, I want to this from the kernel only.
I went through the driver code in "bcm2711_thermal.c - drivers/thermal/broadcom/bcm2711_thermal.c - Linux source code (v6.8.1) - Bootlin"
However, I am not able to figure out where the function "bcm2711_get_temp" is called and how the Raspberry Pi updates the temperature in the file mentioned above. Looking at how the file is updated with the temperature will help me know the kernel code flow and thus, will enable me to achieve my objective.
Any help on going forward is appreciated.
I need some help writing kernel code related to CPU temperature. I am a newbie kernel developer and I have already gone through the basics of driver development and also written a "hello world" driver.
Now, I am looking to up my game and I have assigned myself this project.
The fan will be connected to the GPIO pins. The fan should turn ON when the CPU temperature goes above a certain point. The fan will cool down the CPU and thereafter, when the temperature goes below a certain point, the fan should stop.
Now, I can easily write a python script of a C program in user space for that as the CPU temperature is written to a file "sys/class/hwmon/thermal/thermal_zone0/temp", but that won't help me understand writing the driver or making changes in the kernel. Hence, I want to this from the kernel only.
I went through the driver code in "bcm2711_thermal.c - drivers/thermal/broadcom/bcm2711_thermal.c - Linux source code (v6.8.1) - Bootlin"
However, I am not able to figure out where the function "bcm2711_get_temp" is called and how the Raspberry Pi updates the temperature in the file mentioned above. Looking at how the file is updated with the temperature will help me know the kernel code flow and thus, will enable me to achieve my objective.
Any help on going forward is appreciated.
Statistics: Posted by tha_tha_kernel-dev — Sun Mar 17, 2024 6:15 pm