Re: [PATCH v2] platform/x86: Add support for improved performance mode

From: Mark Pearson
Date: Mon Nov 13 2023 - 10:13:05 EST




On Mon, Nov 13, 2023, at 9:20 AM, Ilpo Järvinen wrote:
> On Mon, 13 Nov 2023, Mark Pearson wrote:
>
>> Some new Thinkpads have a new improved performance mode available.
>> Add support to make this mode usable.
>>
>> To avoid having to create a new profile, just use the improved performance
>> mode in place of the existing performance mode, when available.
>>
>> Tested on P14s AMD G4 AMD.
>>
>> Signed-off-by: Mark Pearson <mpearson-lenovo@xxxxxxxxx>
>> ---
>> Changes in v2: updated implementation for DYTC_UP_SUPPORT define
>>
>> drivers/platform/x86/thinkpad_acpi.c | 28 ++++++++++++++++++++++++++++
>> 1 file changed, 28 insertions(+)
>>
>> diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c
>> index ad460417f901..ed8860caa9c1 100644
>> --- a/drivers/platform/x86/thinkpad_acpi.c
>> +++ b/drivers/platform/x86/thinkpad_acpi.c
>> @@ -10136,6 +10136,7 @@ static struct ibm_struct proxsensor_driver_data = {
>>
>> #define DYTC_CMD_SET 1 /* To enable/disable IC function mode */
>> #define DYTC_CMD_MMC_GET 8 /* To get current MMC function and mode */
>> +#define DYTC_CMD_UP_CAP 0xA /* To get Ultra-performance capability */
>> #define DYTC_CMD_RESET 0x1ff /* To reset back to default */
>>
>> #define DYTC_CMD_FUNC_CAP 3 /* To get DYTC capabilities */
>> @@ -10152,6 +10153,7 @@ static struct ibm_struct proxsensor_driver_data = {
>>
>> #define DYTC_FUNCTION_STD 0 /* Function = 0, standard mode */
>> #define DYTC_FUNCTION_CQL 1 /* Function = 1, lap mode */
>> +#define DYTC_FUNCTION_TMS 9 /* Function = 9, TMS mode */
>> #define DYTC_FUNCTION_MMC 11 /* Function = 11, MMC mode */
>> #define DYTC_FUNCTION_PSC 13 /* Function = 13, PSC mode */
>> #define DYTC_FUNCTION_AMT 15 /* Function = 15, AMT mode */
>> @@ -10163,11 +10165,14 @@ static struct ibm_struct proxsensor_driver_data = {
>> #define DYTC_MODE_MMC_LOWPOWER 3 /* Low power mode */
>> #define DYTC_MODE_MMC_BALANCE 0xF /* Default mode aka balanced */
>> #define DYTC_MODE_MMC_DEFAULT 0 /* Default mode from MMC_GET, aka balanced */
>> +#define DYTC_NOMODE 0xF /* When Function does not have a mode */
>>
>> #define DYTC_MODE_PSC_LOWPOWER 3 /* Low power mode */
>> #define DYTC_MODE_PSC_BALANCE 5 /* Default mode aka balanced */
>> #define DYTC_MODE_PSC_PERFORM 7 /* High power mode aka performance */
>>
>> +#define DYTC_UP_SUPPORT 8 /* Ultra-performance (TMS) mode support */
>
> You forgot to add BIT() here. (But took it away from the other place
> so this patch is actually broken currently I think).
>
Oh....that's odd. I definitely added it (and tested it)...so I'm not sure how I messed that up in the actual commit :(

Apologies - I'll re-post with it corrected.

>> +
>> #define DYTC_ERR_MASK 0xF /* Bits 0-3 in cmd result are the error result */
>> #define DYTC_ERR_SUCCESS 1 /* CMD completed successful */
>>
>> @@ -10185,6 +10190,7 @@ static enum platform_profile_option dytc_current_profile;
>> static atomic_t dytc_ignore_event = ATOMIC_INIT(0);
>> static DEFINE_MUTEX(dytc_mutex);
>> static int dytc_capabilities;
>> +static bool dytc_ultraperf_cap; /* ultra performance capable */
>
> I think the comment is repeating the same information already given in the
> variable name so just drop the comment.
Ack

Mark