summaryrefslogtreecommitdiff
path: root/drivers/hwmon/sfctemp.c
AgeCommit message (Collapse)AuthorFilesLines
2023-01-18hwmon: sfctemp: Fix the problem that cannot disable sfctemp after enabling PMSamin Guo1-43/+43
[runtime_pm off] After Linux starts, it will enable clk and put tempsensor in standby state. When 'cat /sys/class/hwmon/hwmon0/temp1_input' is executed, will switch to the run state, and return the value of the sensor after the interrupt is generated. $ cat /sys/kernel/debug/clk/clk_summary | grep "temp_sensor" enable prepare protect duty hardware clock count count count rate accuracy phase cycle enable ------------------------------------------------------------------------------------------- u0_temp_sensor_clk_temp 1 1 0 1000000 0 0 50000 Y u0_temp_sensor_clk_apb0 1 1 0 49500000 0 0 50000 Y $ cat /sys/class/hwmon/hwmon0/temp1_input 46135 $ cat /sys/class/hwmon/hwmon0/temp1_enable 1 You can 'echo 0 >/sys/class/hwmon/hwmon0/temp1_enable' to turn off the tempsensor and clk. $ echo 0 > /sys/class/hwmon/hwmon0/temp1_enable $ cat /sys/kernel/debug/clk/clk_summary | grep "temp_sensor" enable prepare protect duty hardware clock count count count rate accuracy phase cycle enable ------------------------------------------------------------------------------------------- u0_temp_sensor_clk_temp 0 0 0 1000000 0 0 50000 N u0_temp_sensor_clk_apb0 0 0 0 49500000 0 0 50000 N $ cat /sys/class/hwmon/hwmon0/temp1_enable 0 $ cat /sys/class/hwmon/hwmon0/temp1_input cat: read error: No data available [runtime_pm on] When runtime_pm is turned on, sfctemp will automatically enter the suspend state and close clk after the system is started. $ cat /sys/kernel/debug/clk/clk_summary | grep "temp_sensor" enable prepare protect duty hardware clock count count count rate accuracy phase cycle enable ------------------------------------------------------------------------------------------- u0_temp_sensor_clk_temp 0 0 0 1000000 0 0 50000 N u0_temp_sensor_clk_apb0 0 0 0 49500000 0 0 50000 N when 'cat /sys/class/hwmon/hwmon0/temp1_input', it will call starfive_temp_resume, enable clk and put sfctemp into power on state. $ cat /sys/class/hwmon/hwmon0/temp1_input 46235 After the interrupt is generated and the sensor value is obtained, it will enter the suspend state again. so, hardware-enable-stats is always 'N'. Of course, in this mode (runtime_pm on), it also supports the opening and closing of functions (in fact, clk is not directly operated, and the opening and closing of clk are controlled by runtime_pm) $ cat /sys/class/hwmon/hwmon0/temp1_input 46235 $ cat /sys/class/hwmon/hwmon0/temp1_enable 1 $ echo 0 > /sys/class/hwmon/hwmon0/temp1_enable $ cat /sys/class/hwmon/hwmon0/temp1_enable 0 $ cat /sys/class/hwmon/hwmon0/temp1_input cat: read error: No data available Signed-off-by: Samin Guo <samin.guo@starfivetech.com>
2022-10-27drivers: temp sensor: reset execute permissionsziv.xu1-0/+1
reset execute permissions for FILE: drivers/hwmon/sfctemp.c Signed-off-by: ziv.xu <ziv.xu@starfive.com>
2022-10-27add devcie pm for temp sensorziv.xu1-1/+42
add device pm for temp sensor Signed-off-by: ziv.xu <ziv.xu@starfive.com>
2022-05-19hwmon:sfctemp: add starfive,jh7110-temp bindings.samin1-0/+1
jh7110 and jh7100 use the same configuration. Signed-off-by: samin <samin.guo@starfivetech.com>
2022-05-19hwmon: (sfctemp) Add StarFive JH7100 temperature sensorEmil Renner Berthing1-0/+349
Register definitions and conversion constants based on sfctemp driver by Samin in the StarFive 5.10 kernel. Signed-off-by: Emil Renner Berthing <kernel@esmil.dk> Signed-off-by: Samin Guo <samin.guo@starfivetech.com> Signed-off-by: samin <samin.guo@starfivetech.com>