@@ -10331,6 +10331,10 @@ static struct ibm_struct proxsensor_driver_data = {
1033110331#define DYTC_MODE_PSC_BALANCE 5 /* Default mode aka balanced */
1033210332#define DYTC_MODE_PSC_PERFORM 7 /* High power mode aka performance */
1033310333
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+
1033410338#define DYTC_ERR_MASK 0xF /* Bits 0-3 in cmd result are the error result */
1033510339#define DYTC_ERR_SUCCESS 1 /* CMD completed successful */
1033610340
@@ -10351,6 +10355,10 @@ static int dytc_capabilities;
1035110355static bool dytc_mmc_get_available ;
1035210356static int profile_force ;
1035310357
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+
1035410362static int convert_dytc_to_profile (int funcmode , int dytcmode ,
1035510363 enum platform_profile_option * profile )
1035610364{
@@ -10372,19 +10380,15 @@ static int convert_dytc_to_profile(int funcmode, int dytcmode,
1037210380 }
1037310381 return 0 ;
1037410382 case DYTC_FUNCTION_PSC :
10375- switch (dytcmode ) {
10376- case DYTC_MODE_PSC_LOWPOWER :
10383+ if (dytcmode == platform_psc_profile_lowpower )
1037710384 * profile = PLATFORM_PROFILE_LOW_POWER ;
10378- break ;
10379- case DYTC_MODE_PSC_BALANCE :
10385+ else if (dytcmode == platform_psc_profile_balanced )
1038010386 * profile = PLATFORM_PROFILE_BALANCED ;
10381- break ;
10382- case DYTC_MODE_PSC_PERFORM :
10387+ else if (dytcmode == platform_psc_profile_performance )
1038310388 * profile = PLATFORM_PROFILE_PERFORMANCE ;
10384- break ;
10385- default : /* Unknown mode */
10389+ else
1038610390 return - EINVAL ;
10387- }
10391+
1038810392 return 0 ;
1038910393 case DYTC_FUNCTION_AMT :
1039010394 /* 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
1040510409 if (dytc_capabilities & BIT (DYTC_FC_MMC ))
1040610410 * perfmode = DYTC_MODE_MMC_LOWPOWER ;
1040710411 else if (dytc_capabilities & BIT (DYTC_FC_PSC ))
10408- * perfmode = DYTC_MODE_PSC_LOWPOWER ;
10412+ * perfmode = platform_psc_profile_lowpower ;
1040910413 break ;
1041010414 case PLATFORM_PROFILE_BALANCED :
1041110415 if (dytc_capabilities & BIT (DYTC_FC_MMC ))
1041210416 * perfmode = DYTC_MODE_MMC_BALANCE ;
1041310417 else if (dytc_capabilities & BIT (DYTC_FC_PSC ))
10414- * perfmode = DYTC_MODE_PSC_BALANCE ;
10418+ * perfmode = platform_psc_profile_balanced ;
1041510419 break ;
1041610420 case PLATFORM_PROFILE_PERFORMANCE :
1041710421 if (dytc_capabilities & BIT (DYTC_FC_MMC ))
1041810422 * perfmode = DYTC_MODE_MMC_PERFORM ;
1041910423 else if (dytc_capabilities & BIT (DYTC_FC_PSC ))
10420- * perfmode = DYTC_MODE_PSC_PERFORM ;
10424+ * perfmode = platform_psc_profile_performance ;
1042110425 break ;
1042210426 default : /* Unknown profile */
1042310427 return - EOPNOTSUPP ;
@@ -10611,6 +10615,7 @@ static int tpacpi_dytc_profile_init(struct ibm_init_struct *iibm)
1061110615 if (output & BIT (DYTC_QUERY_ENABLE_BIT ))
1061210616 dytc_version = (output >> DYTC_QUERY_REV_BIT ) & 0xF ;
1061310617
10618+ dbg_printk (TPACPI_DBG_INIT , "DYTC version %d\n" , dytc_version );
1061410619 /* Check DYTC is enabled and supports mode setting */
1061510620 if (dytc_version < 5 )
1061610621 return - ENODEV ;
@@ -10649,6 +10654,11 @@ static int tpacpi_dytc_profile_init(struct ibm_init_struct *iibm)
1064910654 }
1065010655 } else if (dytc_capabilities & BIT (DYTC_FC_PSC )) { /* PSC MODE */
1065110656 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+ }
1065210662 } else {
1065310663 dbg_printk (TPACPI_DBG_INIT , "No DYTC support available\n" );
1065410664 return - ENODEV ;
0 commit comments