Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

thermal: int340x: processor_thermal: Add Tiger Lake support

Added new PCI id for Tiger Lake processor thermal device along with
MMIO RAPL support.

Signed-off-by: Sumeet Pawnikar <sumeet.r.pawnikar@intel.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Link: https://lore.kernel.org/r/1583489952-29612-1-git-send-email-sumeet.r.pawnikar@intel.com

authored by

Sumeet Pawnikar and committed by
Daniel Lezcano
671aa926 afa58b49

+14 -17
+5
drivers/thermal/intel/int340x_thermal/processor_thermal_device.c
··· 45 45 /* JasperLake thermal reporting device */ 46 46 #define PCI_DEVICE_ID_PROC_JSL_THERMAL 0x4503 47 47 48 + /* TigerLake thermal reporting device */ 49 + #define PCI_DEVICE_ID_PROC_TGL_THERMAL 0x9A03 50 + 48 51 #define DRV_NAME "proc_thermal" 49 52 50 53 struct power_config { ··· 731 728 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_PROC_ICL_THERMAL), 732 729 .driver_data = (kernel_ulong_t)&rapl_mmio_hsw, }, 733 730 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_PROC_JSL_THERMAL)}, 731 + { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_PROC_TGL_THERMAL), 732 + .driver_data = (kernel_ulong_t)&rapl_mmio_hsw, }, 734 733 { 0, }, 735 734 }; 736 735
+9 -17
tools/thermal/tmon/tmon.c
··· 46 46 47 47 pthread_t event_tid; 48 48 pthread_mutex_t input_lock; 49 - void usage() 49 + void usage(void) 50 50 { 51 51 printf("Usage: tmon [OPTION...]\n"); 52 52 printf(" -c, --control cooling device in control\n"); ··· 62 62 exit(0); 63 63 } 64 64 65 - void version() 65 + void version(void) 66 66 { 67 67 printf("TMON version %s\n", VERSION); 68 68 exit(EXIT_SUCCESS); ··· 70 70 71 71 static void tmon_cleanup(void) 72 72 { 73 - 74 73 syslog(LOG_INFO, "TMON exit cleanup\n"); 75 74 fflush(stdout); 76 75 refresh(); ··· 95 96 exit(1); 96 97 } 97 98 98 - 99 99 static void tmon_sig_handler(int sig) 100 100 { 101 101 syslog(LOG_INFO, "TMON caught signal %d\n", sig); ··· 117 119 } 118 120 tmon_exit = true; 119 121 } 120 - 121 122 122 123 static void start_syslog(void) 123 124 { ··· 164 167 return; 165 168 } 166 169 167 - 168 170 fprintf(tmon_log, "#----------- THERMAL SYSTEM CONFIG -------------\n"); 169 171 for (i = 0; i < ptdata.nr_tz_sensor; i++) { 170 172 char binding_str[33]; /* size of long + 1 */ ··· 171 175 172 176 memset(binding_str, 0, sizeof(binding_str)); 173 177 for (j = 0; j < 32; j++) 174 - binding_str[j] = (ptdata.tzi[i].cdev_binding & 1<<j) ? 178 + binding_str[j] = (ptdata.tzi[i].cdev_binding & (1 << j)) ? 175 179 '1' : '0'; 176 180 177 181 fprintf(tmon_log, "#thermal zone %s%02d cdevs binding: %32s\n", ··· 183 187 trip_type_name[ptdata.tzi[i].tp[j].type], 184 188 ptdata.tzi[i].tp[j].temp); 185 189 } 186 - 187 190 } 188 191 189 192 for (i = 0; i < ptdata.nr_cooling_dev; i++) ··· 213 218 { "debug", 0, NULL, 'g' }, 214 219 { 0, 0, NULL, 0 } 215 220 }; 216 - 217 221 218 222 int main(int argc, char **argv) 219 223 { ··· 277 283 if (signal(SIGINT, tmon_sig_handler) == SIG_ERR) 278 284 syslog(LOG_DEBUG, "Cannot handle SIGINT\n"); 279 285 if (signal(SIGTERM, tmon_sig_handler) == SIG_ERR) 280 - syslog(LOG_DEBUG, "Cannot handle SIGINT\n"); 286 + syslog(LOG_DEBUG, "Cannot handle SIGTERM\n"); 281 287 282 288 if (probe_thermal_sysfs()) { 283 289 pthread_mutex_destroy(&input_lock); ··· 322 328 show_cooling_device(); 323 329 } 324 330 time_elapsed += ticktime; 325 - controller_handler(trec[0].temp[target_tz_index] / 1000, 326 - &yk); 331 + controller_handler(trec[0].temp[target_tz_index] / 1000, &yk); 327 332 trec[0].pid_out_pct = yk; 328 333 if (!dialogue_on) 329 334 show_control_w(); ··· 333 340 return 0; 334 341 } 335 342 336 - static void start_daemon_mode() 343 + static void start_daemon_mode(void) 337 344 { 338 345 daemon_mode = 1; 339 346 /* fork */ 340 347 pid_t sid, pid = fork(); 341 - if (pid < 0) { 348 + 349 + if (pid < 0) 342 350 exit(EXIT_FAILURE); 343 - } else if (pid > 0) 351 + else if (pid > 0) 344 352 /* kill parent */ 345 353 exit(EXIT_SUCCESS); 346 354 ··· 360 366 if ((chdir("/")) < 0) 361 367 exit(EXIT_FAILURE); 362 368 363 - 364 369 sleep(10); 365 370 366 371 close(STDIN_FILENO); 367 372 close(STDOUT_FILENO); 368 373 close(STDERR_FILENO); 369 - 370 374 }