[PATCH V2 06/17] drm/amd/pm: do not expose the API used internally only in kv_dpm.c

Quan, Evan Evan.Quan at amd.com
Wed Dec 1 02:47:58 UTC 2021


[AMD Official Use Only]



> -----Original Message-----
> From: amd-gfx <amd-gfx-bounces at lists.freedesktop.org> On Behalf Of
> Lazar, Lijo
> Sent: Tuesday, November 30, 2021 8:28 PM
> To: Quan, Evan <Evan.Quan at amd.com>; amd-gfx at lists.freedesktop.org
> Cc: Deucher, Alexander <Alexander.Deucher at amd.com>; Feng, Kenneth
> <Kenneth.Feng at amd.com>; Koenig, Christian <Christian.Koenig at amd.com>
> Subject: Re: [PATCH V2 06/17] drm/amd/pm: do not expose the API used
> internally only in kv_dpm.c
> 
> 
> 
> On 11/30/2021 1:12 PM, Evan Quan wrote:
> > Move it to kv_dpm.c instead.
> >
> > Signed-off-by: Evan Quan <evan.quan at amd.com>
> > Change-Id: I554332b386491a79b7913f72786f1e2cb1f8165b
> > --
> > v1->v2:
> >    - rename the API with "kv_" prefix(Alex)
> > ---
> >   drivers/gpu/drm/amd/pm/amdgpu_dpm.c       | 23 ---------------------
> >   drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h   |  2 --
> >   drivers/gpu/drm/amd/pm/powerplay/kv_dpm.c | 25
> ++++++++++++++++++++++-
> >   3 files changed, 24 insertions(+), 26 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/amd/pm/amdgpu_dpm.c
> > b/drivers/gpu/drm/amd/pm/amdgpu_dpm.c
> > index fbfc07a83122..ecaf0081bc31 100644
> > --- a/drivers/gpu/drm/amd/pm/amdgpu_dpm.c
> > +++ b/drivers/gpu/drm/amd/pm/amdgpu_dpm.c
> > @@ -209,29 +209,6 @@ static u32 amdgpu_dpm_get_vrefresh(struct
> amdgpu_device *adev)
> >   	return vrefresh;
> >   }
> >
> > -bool amdgpu_is_internal_thermal_sensor(enum
> amdgpu_int_thermal_type
> > sensor) -{
> > -	switch (sensor) {
> > -	case THERMAL_TYPE_RV6XX:
> > -	case THERMAL_TYPE_RV770:
> > -	case THERMAL_TYPE_EVERGREEN:
> > -	case THERMAL_TYPE_SUMO:
> > -	case THERMAL_TYPE_NI:
> > -	case THERMAL_TYPE_SI:
> > -	case THERMAL_TYPE_CI:
> > -	case THERMAL_TYPE_KV:
> > -		return true;
> > -	case THERMAL_TYPE_ADT7473_WITH_INTERNAL:
> > -	case THERMAL_TYPE_EMC2103_WITH_INTERNAL:
> > -		return false; /* need special handling */
> > -	case THERMAL_TYPE_NONE:
> > -	case THERMAL_TYPE_EXTERNAL:
> > -	case THERMAL_TYPE_EXTERNAL_GPIO:
> > -	default:
> > -		return false;
> > -	}
> > -}
> > -
> >   union power_info {
> >   	struct _ATOM_POWERPLAY_INFO info;
> >   	struct _ATOM_POWERPLAY_INFO_V2 info_2; diff --git
> > a/drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h
> > b/drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h
> > index f43b96dfe9d8..01120b302590 100644
> > --- a/drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h
> > +++ b/drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h
> > @@ -374,8 +374,6 @@ u32 amdgpu_dpm_get_vblank_time(struct
> amdgpu_device *adev);
> >   int amdgpu_dpm_read_sensor(struct amdgpu_device *adev, enum
> amd_pp_sensors sensor,
> >   			   void *data, uint32_t *size);
> >
> > -bool amdgpu_is_internal_thermal_sensor(enum
> amdgpu_int_thermal_type
> > sensor);
> > -
> >   int amdgpu_get_platform_caps(struct amdgpu_device *adev);
> >
> >   int amdgpu_parse_extended_power_table(struct amdgpu_device *adev);
> > diff --git a/drivers/gpu/drm/amd/pm/powerplay/kv_dpm.c
> > b/drivers/gpu/drm/amd/pm/powerplay/kv_dpm.c
> > index bcae42cef374..380a5336c74f 100644
> > --- a/drivers/gpu/drm/amd/pm/powerplay/kv_dpm.c
> > +++ b/drivers/gpu/drm/amd/pm/powerplay/kv_dpm.c
> > @@ -1256,6 +1256,29 @@ static void kv_dpm_enable_bapm(void *handle,
> bool enable)
> >   	}
> >   }
> >
> > +static bool kv_is_internal_thermal_sensor(enum
> > +amdgpu_int_thermal_type sensor) {
> > +	switch (sensor) {
> > +	case THERMAL_TYPE_RV6XX:
> > +	case THERMAL_TYPE_RV770:
> > +	case THERMAL_TYPE_EVERGREEN:
> > +	case THERMAL_TYPE_SUMO:
> > +	case THERMAL_TYPE_NI:
> > +	case THERMAL_TYPE_SI:
> > +	case THERMAL_TYPE_CI:
> > +	case THERMAL_TYPE_KV:
> > +		return true;
> > +	case THERMAL_TYPE_ADT7473_WITH_INTERNAL:
> > +	case THERMAL_TYPE_EMC2103_WITH_INTERNAL:
> > +		return false; /* need special handling */
> > +	case THERMAL_TYPE_NONE:
> > +	case THERMAL_TYPE_EXTERNAL:
> > +	case THERMAL_TYPE_EXTERNAL_GPIO:
> > +	default:
> > +		return false;
> > +	}
> > +}
> 
> All these names don't look like KV specific. Remove the family specifc ones
> like RV, SI, NI, CI etc., and keep KV and the generic ones like
> GPIO/EXTERNAL/NONE. Don't see a chance of external diodes being used for
> KV.
[Quan, Evan] Make sense. I will create another patch to follow this.
Let's keep minimum change here.

Thanks,
Evan
> 
> Thanks,
> Lijo
> 
> > +
> >   static int kv_dpm_enable(struct amdgpu_device *adev)
> >   {
> >   	struct kv_power_info *pi = kv_get_pi(adev); @@ -1352,7 +1375,7
> @@
> > static int kv_dpm_enable(struct amdgpu_device *adev)
> >   	}
> >
> >   	if (adev->irq.installed &&
> > -	    amdgpu_is_internal_thermal_sensor(adev-
> >pm.int_thermal_type)) {
> > +	    kv_is_internal_thermal_sensor(adev->pm.int_thermal_type)) {
> >   		ret = kv_set_thermal_temperature_range(adev,
> KV_TEMP_RANGE_MIN, KV_TEMP_RANGE_MAX);
> >   		if (ret) {
> >   			DRM_ERROR("kv_set_thermal_temperature_range
> failed\n");
> >


More information about the amd-gfx mailing list