2015년 3월 12일 목요일

망고520 kernel 3.4.35 , kernel 3.0.31 기준 CPU 온도 읽기



커널 3.0.31configuration


커널 버전은 3.0.31을 기준으로 설명합니다.





$ ./build_kernel config

명령 실행 후

System Type  --->
[*] Use thermal management
선택 후
컴파일 하여 , 커널 이미지를 다시Write하면 됩니다.

관련 드라이버 소스는


arch/arm/mach-exynos/tmu-exynos.c


에 있습니다.

관련 코드는 아래와 같습니다.

static int get_cur_temp(struct tmu_info *info)
{
        int curr_temp;
        int temperature;

        /* After reading temperature code from register, compensating
         * its value and calculating celsius temperatue,
         * get current temperatue.
         */
        curr_temp = __raw_readl(info->tmu_base + CURRENT_TEMP) & 0xff;

        /* compensate and calculate current temperature */
        temperature = curr_temp - info->te1 + TMU_DC_VALUE;
        if (temperature < 10) {
                /* temperature code range are between min 10 and 125 */
                pr_alert("Current temperature is in inaccurate range->"
                        " check if vdd_18_ts is on or room temperature.\n");
        }

        return temperature;
}



Kernel 3.0.31 CPU 온도읽기




[root@Mango520 ~]# cat /sys/devices/platform/tmu/temperature
53

섭씨 53도 임을 알수 있습니다.



커널 3.4.35configuration


System Type  --->
SAMSUNG EXYNOS SoCs Support  --->
[*] Use thermal management

Kernel 3.4.35 CPU 온도 읽기

드라이버 소스에서
tmu_debugfs =
                debugfs_create_file("tmu_dev_status",
                                S_IRUGO, NULL, info, &tmu_dev_status_fops);

“debugfs” 파일을 생성하게 되어 있습니다.

[root@Mango520 debug]# mount -t debugfs none /sys/kernel/debug
[root@Mango520 debug]# ls /sys/kernel/debug/
asoc/                              memblock/
bdi/                               mmc0/
binder/                            mmc1/
bluetooth/                         mmc2/
clock/                             pm_qos
dynamic_debug/                     regmap/
extfrag/                           s3c-fb
exynos5_bus                        sched_features
exynos5_devfreq_int_time_in_state  shrinker
exynos5_devfreq_mif_time_in_state  suspend_stats
gpio                               suspend_time*
hid/                               sync
ieee80211/                         tmu_dev_status
ion/                               tracing/
kbase_carveout                     usb/
lpa_cdev_status                    wakeup_sources
mem_usage/
[root@Mango520 debug]# cat /sys/kernel/debug/tmu_dev_status
Current Temperature : 47
Current TMU State : TMU_STATUS_NORMAL
Memory Throttling : unthrottled
Memory throttle auto refresh time : 1937 ns
Normal auto refresh time : 3875 ns
TMU monitoring sample rate : 200 ms
[root@Mango520 debug]# cat /sys/kernel/debug/tmu_dev_status
Current Temperature : 47
Current TMU State : TMU_STATUS_NORMAL
Memory Throttling : unthrottled
Memory throttle auto refresh time : 1937 ns
Normal auto refresh time : 3875 ns
TMU monitoring sample rate : 200 ms


댓글 없음:

댓글 쓰기