@@ -10331,6 +10331,10 @@ static struct ibm_struct proxsensor_driver_data = {
10331
10331
#define DYTC_MODE_PSC_BALANCE 5 /* Default mode aka balanced */
10332
10332
#define DYTC_MODE_PSC_PERFORM 7 /* High power mode aka performance */
10333
10333
10334
+ #define DYTC_MODE_PSCV9_LOWPOWER 1 /* Low power mode */
10335
+ #define DYTC_MODE_PSCV9_BALANCE 3 /* Default mode aka balanced */
10336
+ #define DYTC_MODE_PSCV9_PERFORM 4 /* High power mode aka performance */
10337
+
10334
10338
#define DYTC_ERR_MASK 0xF /* Bits 0-3 in cmd result are the error result */
10335
10339
#define DYTC_ERR_SUCCESS 1 /* CMD completed successful */
10336
10340
@@ -10351,6 +10355,10 @@ static int dytc_capabilities;
10351
10355
static bool dytc_mmc_get_available ;
10352
10356
static int profile_force ;
10353
10357
10358
+ static int platform_psc_profile_lowpower = DYTC_MODE_PSC_LOWPOWER ;
10359
+ static int platform_psc_profile_balanced = DYTC_MODE_PSC_BALANCE ;
10360
+ static int platform_psc_profile_performance = DYTC_MODE_PSC_PERFORM ;
10361
+
10354
10362
static int convert_dytc_to_profile (int funcmode , int dytcmode ,
10355
10363
enum platform_profile_option * profile )
10356
10364
{
@@ -10372,19 +10380,15 @@ static int convert_dytc_to_profile(int funcmode, int dytcmode,
10372
10380
}
10373
10381
return 0 ;
10374
10382
case DYTC_FUNCTION_PSC :
10375
- switch (dytcmode ) {
10376
- case DYTC_MODE_PSC_LOWPOWER :
10383
+ if (dytcmode == platform_psc_profile_lowpower )
10377
10384
* profile = PLATFORM_PROFILE_LOW_POWER ;
10378
- break ;
10379
- case DYTC_MODE_PSC_BALANCE :
10385
+ else if (dytcmode == platform_psc_profile_balanced )
10380
10386
* profile = PLATFORM_PROFILE_BALANCED ;
10381
- break ;
10382
- case DYTC_MODE_PSC_PERFORM :
10387
+ else if (dytcmode == platform_psc_profile_performance )
10383
10388
* profile = PLATFORM_PROFILE_PERFORMANCE ;
10384
- break ;
10385
- default : /* Unknown mode */
10389
+ else
10386
10390
return - EINVAL ;
10387
- }
10391
+
10388
10392
return 0 ;
10389
10393
case DYTC_FUNCTION_AMT :
10390
10394
/* For now return balanced. It's the closest we have to 'auto' */
@@ -10405,19 +10409,19 @@ static int convert_profile_to_dytc(enum platform_profile_option profile, int *pe
10405
10409
if (dytc_capabilities & BIT (DYTC_FC_MMC ))
10406
10410
* perfmode = DYTC_MODE_MMC_LOWPOWER ;
10407
10411
else if (dytc_capabilities & BIT (DYTC_FC_PSC ))
10408
- * perfmode = DYTC_MODE_PSC_LOWPOWER ;
10412
+ * perfmode = platform_psc_profile_lowpower ;
10409
10413
break ;
10410
10414
case PLATFORM_PROFILE_BALANCED :
10411
10415
if (dytc_capabilities & BIT (DYTC_FC_MMC ))
10412
10416
* perfmode = DYTC_MODE_MMC_BALANCE ;
10413
10417
else if (dytc_capabilities & BIT (DYTC_FC_PSC ))
10414
- * perfmode = DYTC_MODE_PSC_BALANCE ;
10418
+ * perfmode = platform_psc_profile_balanced ;
10415
10419
break ;
10416
10420
case PLATFORM_PROFILE_PERFORMANCE :
10417
10421
if (dytc_capabilities & BIT (DYTC_FC_MMC ))
10418
10422
* perfmode = DYTC_MODE_MMC_PERFORM ;
10419
10423
else if (dytc_capabilities & BIT (DYTC_FC_PSC ))
10420
- * perfmode = DYTC_MODE_PSC_PERFORM ;
10424
+ * perfmode = platform_psc_profile_performance ;
10421
10425
break ;
10422
10426
default : /* Unknown profile */
10423
10427
return - EOPNOTSUPP ;
@@ -10611,6 +10615,7 @@ static int tpacpi_dytc_profile_init(struct ibm_init_struct *iibm)
10611
10615
if (output & BIT (DYTC_QUERY_ENABLE_BIT ))
10612
10616
dytc_version = (output >> DYTC_QUERY_REV_BIT ) & 0xF ;
10613
10617
10618
+ dbg_printk (TPACPI_DBG_INIT , "DYTC version %d\n" , dytc_version );
10614
10619
/* Check DYTC is enabled and supports mode setting */
10615
10620
if (dytc_version < 5 )
10616
10621
return - ENODEV ;
@@ -10649,6 +10654,11 @@ static int tpacpi_dytc_profile_init(struct ibm_init_struct *iibm)
10649
10654
}
10650
10655
} else if (dytc_capabilities & BIT (DYTC_FC_PSC )) { /* PSC MODE */
10651
10656
pr_debug ("PSC is supported\n" );
10657
+ if (dytc_version >= 9 ) { /* update profiles for DYTC 9 and up */
10658
+ platform_psc_profile_lowpower = DYTC_MODE_PSCV9_LOWPOWER ;
10659
+ platform_psc_profile_balanced = DYTC_MODE_PSCV9_BALANCE ;
10660
+ platform_psc_profile_performance = DYTC_MODE_PSCV9_PERFORM ;
10661
+ }
10652
10662
} else {
10653
10663
dbg_printk (TPACPI_DBG_INIT , "No DYTC support available\n" );
10654
10664
return - ENODEV ;
0 commit comments