static int mtktspa_get_hw_temp(void) { struct md_info *p_info; int size, i; mutex_lock(&TSPA_lock); mtk_mdm_get_md_info(&p_info, &size); for (i = 0; i < size; i++) { mtktspa_dprintk("PA temperature: name:%s, vaule:%d, invalid_value=%d\n", p_info[i].attribute, p_info[i].value, p_info[i].invalid_value); if (!strcmp(p_info[i].attribute, "RFTEMP_2G_MD1")) { mtktspa_dprintk("PA temperature: RFTEMP_2G_MD1\n"); if (p_info[i].value != p_info[i].invalid_value) break; } else if (!strcmp(p_info[i].attribute, "RFTEMP_3G_MD1")) { mtktspa_dprintk("PA temperature: RFTEMP_3G_MD1\n"); if (p_info[i].value != p_info[i].invalid_value) break; } } if (i == size) { mtktspa_dprintk("PA temperature: not ready\n"); mutex_unlock(&TSPA_lock); return -127000; } else { mtktspa_dprintk("PA temperature: %d\n", p_info[i].value); if ((p_info[i].value > 100000) || (p_info[i].value < -30000)) pr_debug("[Power/PA_Thermal] PA T=%d\n", p_info[i].value); mutex_unlock(&TSPA_lock); return (p_info[i].value); } }
static int mtk_mdm_value_read(char *buf, char **start, off_t off, int count, int *eof, void *data) { int len = 0; struct md_info* p_md; int size; int i; char temp_buf[512]; mtk_mdm_get_md_info(&p_md, &size); sprintf(temp_buf, "%s:%d %s\n", p_md[0].attribute, p_md[0].value, p_md[0].unit); strcpy(buf, temp_buf); for(i=1; i<size; i++){ sprintf(temp_buf, "%s:%d %s\n", p_md[i].attribute, p_md[i].value, p_md[i].unit); strcat(buf, temp_buf); } len = strlen(buf); *start = buf + off; if (len > off) len -= off; else len = 0; return len < count ? len : count; }
int mtk_thermal_get_extra_info( int *no_extra_attr, char ***attr_names, int **attr_values, char ***attr_units) { #if defined(CONFIG_ARCH_MT6589) || defined(CONFIG_ARCH_MT6582) int size, i=0; if (no_extra_attr) *no_extra_attr = NO_EXTRA_THERMAL_ATTR; //****************** // Modem Index //****************** { struct md_info *p_info; mtk_mdm_get_md_info(&p_info, &size); if (size <= NO_EXTRA_THERMAL_ATTR-1) { for (i=0; i<size; i++) { extra_attr_names[i] = p_info[i].attribute; extra_attr_values[i] = p_info[i].value; extra_attr_units[i] = p_info[i].unit; } } } //****************** // Wifi Index //****************** /* Get Wi-Fi Tx throughput */ extra_attr_names[i] = "WiFi_TP"; extra_attr_values[i] = get_sys_wifi_throughput("/proc/wmt_tm/tx_thro", 3); extra_attr_units[i] = "Kbps"; if (attr_names) *attr_names = extra_attr_names; if (attr_values) *attr_values = extra_attr_values; if (attr_units) *attr_units = extra_attr_units; return 0; #else return -1; #endif }
int mtk_thermal_get_extra_info( int *no_extra_attr, char ***attr_names, int **attr_values, char ***attr_units) { int size, i=0; if (no_extra_attr) *no_extra_attr = NO_EXTRA_THERMAL_ATTR; //****************** // Modem Index //****************** THRML_LOG("[mtk_thermal_get_gpu_info] mtk_mdm_get_md_info\n"); { struct md_info *p_info; mtk_mdm_get_md_info(&p_info, &size); THRML_LOG("[mtk_thermal_get_gpu_info] mtk_mdm_get_md_info size %d\n", size); if (size <= NO_EXTRA_THERMAL_ATTR-1) { for (i=0; i<size; i++) { extra_attr_names[i] = p_info[i].attribute; extra_attr_values[i] = p_info[i].value; extra_attr_units[i] = p_info[i].unit; } } } //****************** // Wifi Index //****************** /* Get Wi-Fi Tx throughput */ THRML_LOG("[mtk_thermal_get_gpu_info] get_sys_wifi_throughput\n"); extra_attr_names[i] = "WiFi_TP"; extra_attr_values[i] = get_sys_wifi_throughput("/proc/wmt_tm/tx_thro", 3); extra_attr_units[i] = "Kbps"; if (attr_names) *attr_names = extra_attr_names; if (attr_values) *attr_values = extra_attr_values; if (attr_units) *attr_units = extra_attr_units; return 0; }
static int mtk_mdm_value_read(struct seq_file *m, void *v) { struct md_info *p_md; int size; int i; mtk_mdm_get_md_info(&p_md, &size); seq_printf(m, "%s:%d %s\n", p_md[0].attribute, p_md[0].value, p_md[0].unit); for (i = 1; i < size; i++) seq_printf(m, "%s:%d %s\n", p_md[i].attribute, p_md[i].value, p_md[i].unit); return 0; }