Edit online

Sysfs 节点

Read time: 1 minute(s)
  1. 状态信息
    在 TSensor 驱动初始化成功后,会在 Sysfs 中注册生成一个 status 节点,其中打印了当前的 TSensor 配置及状态信息:
    cat /sys/devices/platform/soc/19253000.tsen/status
    In Thermal Sensor V1.00:
     ch0: aic-tsen-cpu, Enable: 1, Value: 0
     ch1: aic-tsen-adc, Enable: 1,Value: 0
  2. 读取温度

    Linux Thermal 子系统提供一些 Sysfs 节点,可以用来获取温度值以及其它参数信息。

    例如,/sys/class/thermal/ 目录提供了下列与温度相关的信息:
    • 列出可用的 thermal zone:
      ls /sys/class/thermal/
      输出示例如下:
      thermal_zone0  thermal_zone1
    • 查看特定 thermal zone 的相关信息:
      ls thermal_zone0/
      输出示例如下:
      available_policies  k_po                policy              type
      hwmon0              k_pu                slope               uevent
      integral_cutoff     mode                subsystem
      k_d                 offset              sustainable_power
      k_i                 passive             temp
      • 读取温度值
        cat temp
        输出示例如下,表示当前 Tj 温度为 63.262度:
        63262
      • 读取类型信息
        cat type
        输出示例如下:
        aic-tsen-cpu