Skip to content

Commit 671aa92

Browse files
sumeetpawnikardlezcano
authored andcommitted
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 <[email protected]> Signed-off-by: Zhang Rui <[email protected]> Signed-off-by: Daniel Lezcano <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent afa58b4 commit 671aa92

File tree

2 files changed

+14
-17
lines changed

2 files changed

+14
-17
lines changed

drivers/thermal/intel/int340x_thermal/processor_thermal_device.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@
4545
/* JasperLake thermal reporting device */
4646
#define PCI_DEVICE_ID_PROC_JSL_THERMAL 0x4503
4747

48+
/* TigerLake thermal reporting device */
49+
#define PCI_DEVICE_ID_PROC_TGL_THERMAL 0x9A03
50+
4851
#define DRV_NAME "proc_thermal"
4952

5053
struct power_config {
@@ -728,6 +731,8 @@ static const struct pci_device_id proc_thermal_pci_ids[] = {
728731
{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_PROC_ICL_THERMAL),
729732
.driver_data = (kernel_ulong_t)&rapl_mmio_hsw, },
730733
{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_PROC_JSL_THERMAL)},
734+
{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_PROC_TGL_THERMAL),
735+
.driver_data = (kernel_ulong_t)&rapl_mmio_hsw, },
731736
{ 0, },
732737
};
733738

tools/thermal/tmon/tmon.c

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ static void start_daemon_mode(void);
4646

4747
pthread_t event_tid;
4848
pthread_mutex_t input_lock;
49-
void usage()
49+
void usage(void)
5050
{
5151
printf("Usage: tmon [OPTION...]\n");
5252
printf(" -c, --control cooling device in control\n");
@@ -62,15 +62,14 @@ void usage()
6262
exit(0);
6363
}
6464

65-
void version()
65+
void version(void)
6666
{
6767
printf("TMON version %s\n", VERSION);
6868
exit(EXIT_SUCCESS);
6969
}
7070

7171
static void tmon_cleanup(void)
7272
{
73-
7473
syslog(LOG_INFO, "TMON exit cleanup\n");
7574
fflush(stdout);
7675
refresh();
@@ -96,7 +95,6 @@ static void tmon_cleanup(void)
9695
exit(1);
9796
}
9897

99-
10098
static void tmon_sig_handler(int sig)
10199
{
102100
syslog(LOG_INFO, "TMON caught signal %d\n", sig);
@@ -120,7 +118,6 @@ static void tmon_sig_handler(int sig)
120118
tmon_exit = true;
121119
}
122120

123-
124121
static void start_syslog(void)
125122
{
126123
if (debug_on)
@@ -167,15 +164,14 @@ static void prepare_logging(void)
167164
return;
168165
}
169166

170-
171167
fprintf(tmon_log, "#----------- THERMAL SYSTEM CONFIG -------------\n");
172168
for (i = 0; i < ptdata.nr_tz_sensor; i++) {
173169
char binding_str[33]; /* size of long + 1 */
174170
int j;
175171

176172
memset(binding_str, 0, sizeof(binding_str));
177173
for (j = 0; j < 32; j++)
178-
binding_str[j] = (ptdata.tzi[i].cdev_binding & 1<<j) ?
174+
binding_str[j] = (ptdata.tzi[i].cdev_binding & (1 << j)) ?
179175
'1' : '0';
180176

181177
fprintf(tmon_log, "#thermal zone %s%02d cdevs binding: %32s\n",
@@ -187,7 +183,6 @@ static void prepare_logging(void)
187183
trip_type_name[ptdata.tzi[i].tp[j].type],
188184
ptdata.tzi[i].tp[j].temp);
189185
}
190-
191186
}
192187

193188
for (i = 0; i < ptdata.nr_cooling_dev; i++)
@@ -219,7 +214,6 @@ static struct option opts[] = {
219214
{ 0, 0, NULL, 0 }
220215
};
221216

222-
223217
int main(int argc, char **argv)
224218
{
225219
int err = 0;
@@ -283,7 +277,7 @@ int main(int argc, char **argv)
283277
if (signal(SIGINT, tmon_sig_handler) == SIG_ERR)
284278
syslog(LOG_DEBUG, "Cannot handle SIGINT\n");
285279
if (signal(SIGTERM, tmon_sig_handler) == SIG_ERR)
286-
syslog(LOG_DEBUG, "Cannot handle SIGINT\n");
280+
syslog(LOG_DEBUG, "Cannot handle SIGTERM\n");
287281

288282
if (probe_thermal_sysfs()) {
289283
pthread_mutex_destroy(&input_lock);
@@ -328,8 +322,7 @@ int main(int argc, char **argv)
328322
show_cooling_device();
329323
}
330324
time_elapsed += ticktime;
331-
controller_handler(trec[0].temp[target_tz_index] / 1000,
332-
&yk);
325+
controller_handler(trec[0].temp[target_tz_index] / 1000, &yk);
333326
trec[0].pid_out_pct = yk;
334327
if (!dialogue_on)
335328
show_control_w();
@@ -340,14 +333,15 @@ int main(int argc, char **argv)
340333
return 0;
341334
}
342335

343-
static void start_daemon_mode()
336+
static void start_daemon_mode(void)
344337
{
345338
daemon_mode = 1;
346339
/* fork */
347340
pid_t sid, pid = fork();
348-
if (pid < 0) {
341+
342+
if (pid < 0)
349343
exit(EXIT_FAILURE);
350-
} else if (pid > 0)
344+
else if (pid > 0)
351345
/* kill parent */
352346
exit(EXIT_SUCCESS);
353347

@@ -366,11 +360,9 @@ static void start_daemon_mode()
366360
if ((chdir("/")) < 0)
367361
exit(EXIT_FAILURE);
368362

369-
370363
sleep(10);
371364

372365
close(STDIN_FILENO);
373366
close(STDOUT_FILENO);
374367
close(STDERR_FILENO);
375-
376368
}

0 commit comments

Comments
 (0)