[PATCH v2] drm/amd/pm: Disable fan control if not supported
On Sienna Cichild, not all platforms use PMFW based fan control. On such ASICs fan control by PMFW will be disabled in PPTable. Disable hwmon knobs for fan control also as it is not possible to report or control fan speed on such platforms through driver. v2: FEATURE_FAN_CONTROL_MASK is replaced with FEATURE_FAN_CONTROL_BIT Signed-off-by: Elena Sakhnovitch Change-Id: I42f9eb971a61a5ad63327607479fc7e9d9d6914d --- .../drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c | 15 ++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c index 38f04836c82f..23abb1d1f677 100644 --- a/drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +++ b/drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c @@ -371,6 +371,18 @@ static void sienna_cichlid_check_bxco_support(struct smu_context *smu) } } +static void sienna_cichlid_check_fan_support(struct smu_context *smu) +{ + struct smu_table_context *table_context = &smu->smu_table; + PPTable_t *pptable = table_context->driver_pptable; + /* No sort of fan control possible if PPTable has it disabled */ + smu->adev->pm.no_fan = + !(pptable->FeaturesToRun[0] & FEATURE_FAN_CONTROL_MASK); + if (smu->adev->pm.no_fan) + dev_info_once(smu->adev->dev, + "PMFW based fan control disabled"); +} + static int sienna_cichlid_check_powerplay_table(struct smu_context *smu) { struct smu_table_context *table_context = &smu->smu_table; @@ -381,6 +393,7 @@ static int sienna_cichlid_check_powerplay_table(struct smu_context *smu) smu->dc_controlled_by_gpio = true; sienna_cichlid_check_bxco_support(smu); + sienna_cichlid_check_fan_support(smu); table_context->thermal_controller_type = powerplay_table->thermal_controller_type; @@ -410,7 +423,7 @@ static int sienna_cichlid_append_powerplay_table(struct smu_context *smu) GET_PPTABLE_MEMBER(I2cControllers, &table_member); memcpy(table_member, smc_dpm_table->I2cControllers, sizeof(*smc_dpm_table) - sizeof(smc_dpm_table->table_header)); - + return 0; } -- 2.25.1
[PATCH v2] drm/amd/pm: Disable fan control if not supported
On Sienna Cichild, not all platforms use PMFW based fan control. On such ASICs fan control by PMFW will be disabled in PPTable. Disable hwmon knobs for fan control also as it is not possible to report or control fan speed on such platforms through driver. v2: FEATURE_FAN_CONTROL_MASK is replaced with FEATURE_FAN_CONTROL_BIT Signed-off-by: Elena Sakhnovitch --- .../drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c | 15 ++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c index 38f04836c82f..23abb1d1f677 100644 --- a/drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +++ b/drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c @@ -371,6 +371,18 @@ static void sienna_cichlid_check_bxco_support(struct smu_context *smu) } } +static void sienna_cichlid_check_fan_support(struct smu_context *smu) +{ + struct smu_table_context *table_context = &smu->smu_table; + PPTable_t *pptable = table_context->driver_pptable; + /* No sort of fan control possible if PPTable has it disabled */ + smu->adev->pm.no_fan = + !(pptable->FeaturesToRun[0] & FEATURE_FAN_CONTROL_MASK); + if (smu->adev->pm.no_fan) + dev_info_once(smu->adev->dev, + "PMFW based fan control disabled"); +} + static int sienna_cichlid_check_powerplay_table(struct smu_context *smu) { struct smu_table_context *table_context = &smu->smu_table; @@ -381,6 +393,7 @@ static int sienna_cichlid_check_powerplay_table(struct smu_context *smu) smu->dc_controlled_by_gpio = true; sienna_cichlid_check_bxco_support(smu); + sienna_cichlid_check_fan_support(smu); table_context->thermal_controller_type = powerplay_table->thermal_controller_type; @@ -410,7 +423,7 @@ static int sienna_cichlid_append_powerplay_table(struct smu_context *smu) GET_PPTABLE_MEMBER(I2cControllers, &table_member); memcpy(table_member, smc_dpm_table->I2cControllers, sizeof(*smc_dpm_table) - sizeof(smc_dpm_table->table_header)); - + return 0; } -- 2.25.1
[PATCH v2] drm/amd/pm: Disable fan control if not supported
On Sienna Cichild, not all platforms use PMFW based fan control. On such ASICs fan control by PMFW will be disabled in PPTable. Disable hwmon knobs for fan control also as it is not possible to report or control fan speed on such platforms through driver. v2: FEATURE_FAN_CONTROL_MASK is replaced with FEATURE_FAN_CONTROL_BIT Signed-off-by: Elena Sakhnovitch --- .../drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c | 15 ++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c index 38f04836c82f..c4fd70376481 100644 --- a/drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +++ b/drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c @@ -371,6 +371,18 @@ static void sienna_cichlid_check_bxco_support(struct smu_context *smu) } } +static void sienna_cichlid_check_fan_support(struct smu_context *smu) +{ + struct smu_table_context *table_context = &smu->smu_table; + PPTable_t *pptable = table_context->driver_pptable; + /* No sort of fan control possible if PPTable has it disabled */ + smu->adev->pm.no_fan = + !(pptable->FeaturesToRun[0] & ( 1U << FEATURE_FAN_CONTROL_BIT)); + if (smu->adev->pm.no_fan) + dev_info_once(smu->adev->dev, + "PMFW based fan control disabled"); +} + static int sienna_cichlid_check_powerplay_table(struct smu_context *smu) { struct smu_table_context *table_context = &smu->smu_table; @@ -381,6 +393,7 @@ static int sienna_cichlid_check_powerplay_table(struct smu_context *smu) smu->dc_controlled_by_gpio = true; sienna_cichlid_check_bxco_support(smu); + sienna_cichlid_check_fan_support(smu); table_context->thermal_controller_type = powerplay_table->thermal_controller_type; @@ -410,7 +423,7 @@ static int sienna_cichlid_append_powerplay_table(struct smu_context *smu) GET_PPTABLE_MEMBER(I2cControllers, &table_member); memcpy(table_member, smc_dpm_table->I2cControllers, sizeof(*smc_dpm_table) - sizeof(smc_dpm_table->table_header)); - + return 0; } -- 2.25.1
[PATCH v2] drm/amd/pm: Disable fan control if not supported
On Sienna Cichild, not all platforms use PMFW based fan control. On such ASICs fan control by PMFW will be disabled in PPTable. Disable hwmon knobs for fan control also as it is not possible to report or control fan speed on such platforms through driver. v2: FEATURE_FAN_CONTROL_MASK is replaced with FEATURE_FAN_CONTROL_BIT Signed-off-by: Elena Sakhnovitch --- .../drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c | 15 ++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c index ab3e9d8b831e..ddc388b061b6 100644 --- a/drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +++ b/drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c @@ -371,6 +371,18 @@ static void sienna_cichlid_check_bxco_support(struct smu_context *smu) } } +static void sienna_cichlid_check_fan_support(struct smu_context *smu) +{ + struct smu_table_context *table_context = &smu->smu_table; + PPTable_t *pptable = table_context->driver_pptable; + /* No sort of fan control possible if PPTable has it disabled */ + smu->adev->pm.no_fan = + !(pptable->FeaturesToRun[1] & (1U << FEATURE_FAN_CONTROL_BIT)); + if (smu->adev->pm.no_fan) + dev_info_once(smu->adev->dev, + "PMFW based fan control disabled"); +} + static int sienna_cichlid_check_powerplay_table(struct smu_context *smu) { struct smu_table_context *table_context = &smu->smu_table; @@ -381,6 +393,7 @@ static int sienna_cichlid_check_powerplay_table(struct smu_context *smu) smu->dc_controlled_by_gpio = true; sienna_cichlid_check_bxco_support(smu); + sienna_cichlid_check_fan_support(smu); table_context->thermal_controller_type = powerplay_table->thermal_controller_type; @@ -410,7 +423,7 @@ static int sienna_cichlid_append_powerplay_table(struct smu_context *smu) GET_PPTABLE_MEMBER(I2cControllers, &table_member); memcpy(table_member, smc_dpm_table->I2cControllers, sizeof(*smc_dpm_table) - sizeof(smc_dpm_table->table_header)); - + return 0; } -- 2.25.1
RE: [PATCH v2] drm/amd/pm: Disable fan control if not supported
[AMD Official Use Only] Few comments inline. -Original Message- From: amd-gfx On Behalf Of Elena Sakhnovitch Sent: Thursday, March 17, 2022 12:45 PM To: amd-gfx@lists.freedesktop.org Cc: Sakhnovitch, Elena (Elen) Subject: [PATCH v2] drm/amd/pm: Disable fan control if not supported On Sienna Cichild, not all platforms use PMFW based fan control. On such ASICs fan control by PMFW will be disabled in PPTable. Disable hwmon knobs for fan control also as it is not possible to report or control fan speed on such platforms through driver. v2: FEATURE_FAN_CONTROL_MASK is replaced with FEATURE_FAN_CONTROL_BIT Signed-off-by: Elena Sakhnovitch --- .../drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c | 15 ++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c index 38f04836c82f..c4fd70376481 100644 --- a/drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +++ b/drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c @@ -371,6 +371,18 @@ static void sienna_cichlid_check_bxco_support(struct smu_context *smu) } } +static void sienna_cichlid_check_fan_support(struct smu_context *smu) +{ + struct smu_table_context *table_context = &smu->smu_table; + PPTable_t *pptable = table_context->driver_pptable; + /* No sort of fan control possible if PPTable has it disabled */ + smu->adev->pm.no_fan = + !(pptable->FeaturesToRun[0] & ( 1U << FEATURE_FAN_CONTROL_BIT)); [HK]: FEATURE_FAN_CONTROL_BIT (for sienna_cichlid) == 32. This means you would have to use FeaturesToRun[1]. [HK]: ( 1U << FEATURE_FAN_CONTROL_BIT)); There is an extra space which checkcommit will complain. ERROR: space prohibited after that open parenthesis '(' #29: FILE: drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c:380: + !(pptable->FeaturesToRun[0] & ( 1U << FEATURE_FAN_CONTROL_BIT)); + if (smu->adev->pm.no_fan) + dev_info_once(smu->adev->dev, + "PMFW based fan control disabled"); +} + static int sienna_cichlid_check_powerplay_table(struct smu_context *smu) { struct smu_table_context *table_context = &smu->smu_table; @@ -381,6 +393,7 @@ static int sienna_cichlid_check_powerplay_table(struct smu_context *smu) smu->dc_controlled_by_gpio = true; sienna_cichlid_check_bxco_support(smu); + sienna_cichlid_check_fan_support(smu); table_context->thermal_controller_type = powerplay_table->thermal_controller_type; @@ -410,7 +423,7 @@ static int sienna_cichlid_append_powerplay_table(struct smu_context *smu) GET_PPTABLE_MEMBER(I2cControllers, &table_member); memcpy(table_member, smc_dpm_table->I2cControllers, sizeof(*smc_dpm_table) - sizeof(smc_dpm_table->table_header)); - + [HK]: unnecessary change return 0; } -- 2.25.1
Re: [PATCH v2] drm/amd/pm: Disable fan control if not supported
On 4/11/2022 7:02 PM, Elena Sakhnovitch wrote: On Sienna Cichild, not all platforms use PMFW based fan control. On such ASICs fan control by PMFW will be disabled in PPTable. Disable hwmon knobs for fan control also as it is not possible to report or control fan speed on such platforms through driver. v2: FEATURE_FAN_CONTROL_MASK is replaced with FEATURE_FAN_CONTROL_BIT Signed-off-by: Elena Sakhnovitch --- .../drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c | 15 ++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c index ab3e9d8b831e..ddc388b061b6 100644 --- a/drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +++ b/drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c @@ -371,6 +371,18 @@ static void sienna_cichlid_check_bxco_support(struct smu_context *smu) } } +static void sienna_cichlid_check_fan_support(struct smu_context *smu) +{ + struct smu_table_context *table_context = &smu->smu_table; + PPTable_t *pptable = table_context->driver_pptable; + /* No sort of fan control possible if PPTable has it disabled */ + smu->adev->pm.no_fan = + !(pptable->FeaturesToRun[1] & (1U << FEATURE_FAN_CONTROL_BIT)); #define FEATURE_FAN_CONTROL_BIT 32 Given the above, this doesn't work. You may cast FeaturesToRun as uin64_t* and use a mask like 1ULL << FEATURE_FAN_CONTROL_BIT Thanks, Lijo + if (smu->adev->pm.no_fan) + dev_info_once(smu->adev->dev, + "PMFW based fan control disabled"); +} + static int sienna_cichlid_check_powerplay_table(struct smu_context *smu) { struct smu_table_context *table_context = &smu->smu_table; @@ -381,6 +393,7 @@ static int sienna_cichlid_check_powerplay_table(struct smu_context *smu) smu->dc_controlled_by_gpio = true; sienna_cichlid_check_bxco_support(smu); + sienna_cichlid_check_fan_support(smu); table_context->thermal_controller_type = powerplay_table->thermal_controller_type; @@ -410,7 +423,7 @@ static int sienna_cichlid_append_powerplay_table(struct smu_context *smu) GET_PPTABLE_MEMBER(I2cControllers, &table_member); memcpy(table_member, smc_dpm_table->I2cControllers, sizeof(*smc_dpm_table) - sizeof(smc_dpm_table->table_header)); - + return 0; }
Re: [PATCH v2] drm/amd/pm: Disable fan control if not supported
Dear Elena, Am 11.04.22 um 15:32 schrieb Elena Sakhnovitch: On Sienna Cichild, not all platforms use PMFW based fan control. On such ASICs fan control by PMFW will be disabled in PPTable. Disable hwmon knobs for fan control also as it is not possible to report or control fan speed on such platforms through driver. v2: FEATURE_FAN_CONTROL_MASK is replaced with FEATURE_FAN_CONTROL_BIT Please add a blank line before the v2 line. Also please give one specific example for a platform without PMFW based fan control. Signed-off-by: Elena Sakhnovitch --- .../drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c | 15 ++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c index ab3e9d8b831e..ddc388b061b6 100644 --- a/drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +++ b/drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c @@ -371,6 +371,18 @@ static void sienna_cichlid_check_bxco_support(struct smu_context *smu) } } +static void sienna_cichlid_check_fan_support(struct smu_context *smu) +{ + struct smu_table_context *table_context = &smu->smu_table; + PPTable_t *pptable = table_context->driver_pptable; + /* No sort of fan control possible if PPTable has it disabled */ + smu->adev->pm.no_fan = + !(pptable->FeaturesToRun[1] & (1U << FEATURE_FAN_CONTROL_BIT)); + if (smu->adev->pm.no_fan) + dev_info_once(smu->adev->dev, + "PMFW based fan control disabled"); Maybe clarify: … according to PPTable. +} + static int sienna_cichlid_check_powerplay_table(struct smu_context *smu) { struct smu_table_context *table_context = &smu->smu_table; @@ -381,6 +393,7 @@ static int sienna_cichlid_check_powerplay_table(struct smu_context *smu) smu->dc_controlled_by_gpio = true; sienna_cichlid_check_bxco_support(smu); + sienna_cichlid_check_fan_support(smu); table_context->thermal_controller_type = powerplay_table->thermal_controller_type; @@ -410,7 +423,7 @@ static int sienna_cichlid_append_powerplay_table(struct smu_context *smu) GET_PPTABLE_MEMBER(I2cControllers, &table_member); memcpy(table_member, smc_dpm_table->I2cControllers, sizeof(*smc_dpm_table) - sizeof(smc_dpm_table->table_header)); - + Unrelated, and should be a separate patch. return 0; } Kind regards, Paul