@@ -66,6 +66,11 @@ static const char *const omen_thermal_profile_force_v0_boards[] = {
66
66
"8607" , "8746" , "8747" , "8749" , "874A" , "8748"
67
67
};
68
68
69
+ /* DMI Board names of Victus laptops */
70
+ static const char * const victus_thermal_profile_boards [] = {
71
+ "8A25"
72
+ };
73
+
69
74
enum hp_wmi_radio {
70
75
HPWMI_WIFI = 0x0 ,
71
76
HPWMI_BLUETOOTH = 0x1 ,
@@ -177,6 +182,12 @@ enum hp_thermal_profile_omen_v1 {
177
182
HP_OMEN_V1_THERMAL_PROFILE_COOL = 0x50 ,
178
183
};
179
184
185
+ enum hp_thermal_profile_victus {
186
+ HP_VICTUS_THERMAL_PROFILE_DEFAULT = 0x00 ,
187
+ HP_VICTUS_THERMAL_PROFILE_PERFORMANCE = 0x01 ,
188
+ HP_VICTUS_THERMAL_PROFILE_QUIET = 0x03 ,
189
+ };
190
+
180
191
enum hp_thermal_profile {
181
192
HP_THERMAL_PROFILE_PERFORMANCE = 0x00 ,
182
193
HP_THERMAL_PROFILE_DEFAULT = 0x01 ,
@@ -1299,6 +1310,70 @@ static int hp_wmi_platform_profile_set(struct platform_profile_handler *pprof,
1299
1310
return 0 ;
1300
1311
}
1301
1312
1313
+ static bool is_victus_thermal_profile (void )
1314
+ {
1315
+ const char * board_name = dmi_get_system_info (DMI_BOARD_NAME );
1316
+
1317
+ if (!board_name )
1318
+ return false;
1319
+
1320
+ return match_string (victus_thermal_profile_boards ,
1321
+ ARRAY_SIZE (victus_thermal_profile_boards ),
1322
+ board_name ) >= 0 ;
1323
+ }
1324
+
1325
+ static int platform_profile_victus_get (struct platform_profile_handler * pprof ,
1326
+ enum platform_profile_option * profile )
1327
+ {
1328
+ int tp ;
1329
+
1330
+ tp = omen_thermal_profile_get ();
1331
+ if (tp < 0 )
1332
+ return tp ;
1333
+
1334
+ switch (tp ) {
1335
+ case HP_VICTUS_THERMAL_PROFILE_PERFORMANCE :
1336
+ * profile = PLATFORM_PROFILE_PERFORMANCE ;
1337
+ break ;
1338
+ case HP_VICTUS_THERMAL_PROFILE_DEFAULT :
1339
+ * profile = PLATFORM_PROFILE_BALANCED ;
1340
+ break ;
1341
+ case HP_VICTUS_THERMAL_PROFILE_QUIET :
1342
+ * profile = PLATFORM_PROFILE_QUIET ;
1343
+ break ;
1344
+ default :
1345
+ return - EOPNOTSUPP ;
1346
+ }
1347
+
1348
+ return 0 ;
1349
+ }
1350
+
1351
+ static int platform_profile_victus_set (struct platform_profile_handler * pprof ,
1352
+ enum platform_profile_option profile )
1353
+ {
1354
+ int err , tp ;
1355
+
1356
+ switch (profile ) {
1357
+ case PLATFORM_PROFILE_PERFORMANCE :
1358
+ tp = HP_VICTUS_THERMAL_PROFILE_PERFORMANCE ;
1359
+ break ;
1360
+ case PLATFORM_PROFILE_BALANCED :
1361
+ tp = HP_VICTUS_THERMAL_PROFILE_DEFAULT ;
1362
+ break ;
1363
+ case PLATFORM_PROFILE_QUIET :
1364
+ tp = HP_VICTUS_THERMAL_PROFILE_QUIET ;
1365
+ break ;
1366
+ default :
1367
+ return - EOPNOTSUPP ;
1368
+ }
1369
+
1370
+ err = omen_thermal_profile_set (tp );
1371
+ if (err < 0 )
1372
+ return err ;
1373
+
1374
+ return 0 ;
1375
+ }
1376
+
1302
1377
static int thermal_profile_setup (void )
1303
1378
{
1304
1379
int err , tp ;
@@ -1319,6 +1394,25 @@ static int thermal_profile_setup(void)
1319
1394
1320
1395
platform_profile_handler .profile_get = platform_profile_omen_get ;
1321
1396
platform_profile_handler .profile_set = platform_profile_omen_set ;
1397
+
1398
+ set_bit (PLATFORM_PROFILE_COOL , platform_profile_handler .choices );
1399
+ } else if (is_victus_thermal_profile ()) {
1400
+ tp = omen_thermal_profile_get ();
1401
+ if (tp < 0 )
1402
+ return tp ;
1403
+
1404
+ /*
1405
+ * call thermal profile write command to ensure that the
1406
+ * firmware correctly sets the OEM variables
1407
+ */
1408
+ err = omen_thermal_profile_set (tp );
1409
+ if (err < 0 )
1410
+ return err ;
1411
+
1412
+ platform_profile_handler .profile_get = platform_profile_victus_get ;
1413
+ platform_profile_handler .profile_set = platform_profile_victus_set ;
1414
+
1415
+ set_bit (PLATFORM_PROFILE_QUIET , platform_profile_handler .choices );
1322
1416
} else {
1323
1417
tp = thermal_profile_get ();
1324
1418
@@ -1337,9 +1431,9 @@ static int thermal_profile_setup(void)
1337
1431
platform_profile_handler .profile_set = hp_wmi_platform_profile_set ;
1338
1432
1339
1433
set_bit (PLATFORM_PROFILE_QUIET , platform_profile_handler .choices );
1434
+ set_bit (PLATFORM_PROFILE_COOL , platform_profile_handler .choices );
1340
1435
}
1341
1436
1342
- set_bit (PLATFORM_PROFILE_COOL , platform_profile_handler .choices );
1343
1437
set_bit (PLATFORM_PROFILE_BALANCED , platform_profile_handler .choices );
1344
1438
set_bit (PLATFORM_PROFILE_PERFORMANCE , platform_profile_handler .choices );
1345
1439
0 commit comments