Edit online

调试指南

3 Mar 2025
Read time: 1 minute(s)

本节介绍 TSensor 调试步骤。

打开调试开关

  1. 在内核配置界面,按如下选择,打开调试开关:
    Linux
        Kernel hacking
            ArtInChip Debug
                [*] Thermal Sensor driver debug

    在内核配置界面,按如下选择,打开调试开关:

Sysfs 节点

  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:
      cd /sys/class/thermal/
      ls
      输出示例如下:
      thermal_zone0  thermal_zone1
    • 进入 thermal_zone0 目录,查看特定 thermal zone 的相关信息:
      cd thermal_zone0/
      ls
      输出示例如下:
      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
        输出示例如下,表示当前温度为 0:
        0
      • 读取类型信息
        cat type
        输出示例如下:
        aic-tsen-cpu