2014년 9월 22일 월요일

망고520 CPU Temperature 읽어오기-20140923


  1. 포팅하기


Datasheet를 보면 , Table이 있습니다.
“Thermal Management Unit” Chapter에 보면


레지스터는

입니다.



    1. 커널 configuration


커널 버전은 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;
}



    1. CPU 온도 읽기




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

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

댓글 없음:

댓글 쓰기