[PATCH 1/5] drm/amd/powerplay: delete useless code in hwmgr.

Edward O'Callaghan funfunctor at folklore1984.net
Tue Aug 2 00:27:13 UTC 2016


This series is,

Reviewed-by: Edward O'Callaghan <funfunctor at folklore1984.net>

On 08/01/2016 09:33 PM, Rex Zhu wrote:
> Change-Id: I047ed9679598b0e519e49b12414ca7f629c67870
> Signed-off-by: Rex Zhu <Rex.Zhu at amd.com>
> Reviewed-by: Alex Deucher <alexander.deucher at amd.com>
> ---
>  drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c |  36 ----------
>  drivers/gpu/drm/amd/powerplay/inc/hwmgr.h   | 108 ++--------------------------
>  2 files changed, 7 insertions(+), 137 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c
> index 384b425..ba8f57a 100644
> --- a/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c
> +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c
> @@ -206,29 +206,7 @@ int phm_wait_on_register(struct pp_hwmgr *hwmgr, uint32_t index,
>  	return 0;
>  }
>  
> -int phm_wait_for_register_unequal(struct pp_hwmgr *hwmgr,
> -				uint32_t index, uint32_t value, uint32_t mask)
> -{
> -	uint32_t i;
> -	uint32_t cur_value;
> -
> -	if (hwmgr == NULL || hwmgr->device == NULL) {
> -		printk(KERN_ERR "[ powerplay ] Invalid Hardware Manager!");
> -		return -EINVAL;
> -	}
> -
> -	for (i = 0; i < hwmgr->usec_timeout; i++) {
> -		cur_value = cgs_read_register(hwmgr->device, index);
> -		if ((cur_value & mask) != (value & mask))
> -			break;
> -		udelay(1);
> -	}
>  
> -	/* timeout means wrong logic*/
> -	if (i == hwmgr->usec_timeout)
> -		return -1;
> -	return 0;
> -}
>  
>  
>  /**
> @@ -251,21 +229,7 @@ void phm_wait_on_indirect_register(struct pp_hwmgr *hwmgr,
>  	phm_wait_on_register(hwmgr, indirect_port + 1, mask, value);
>  }
>  
> -void phm_wait_for_indirect_register_unequal(struct pp_hwmgr *hwmgr,
> -					uint32_t indirect_port,
> -					uint32_t index,
> -					uint32_t value,
> -					uint32_t mask)
> -{
> -	if (hwmgr == NULL || hwmgr->device == NULL) {
> -		printk(KERN_ERR "[ powerplay ] Invalid Hardware Manager!");
> -		return;
> -	}
>  
> -	cgs_write_register(hwmgr->device, indirect_port, index);
> -	phm_wait_for_register_unequal(hwmgr, indirect_port + 1,
> -				      value, mask);
> -}
>  
>  bool phm_cf_want_uvd_power_gating(struct pp_hwmgr *hwmgr)
>  {
> diff --git a/drivers/gpu/drm/amd/powerplay/inc/hwmgr.h b/drivers/gpu/drm/amd/powerplay/inc/hwmgr.h
> index 911081c..36b4ec9 100644
> --- a/drivers/gpu/drm/amd/powerplay/inc/hwmgr.h
> +++ b/drivers/gpu/drm/amd/powerplay/inc/hwmgr.h
> @@ -639,16 +639,7 @@ extern int hw_init_power_state_table(struct pp_hwmgr *hwmgr);
>  extern int phm_wait_on_register(struct pp_hwmgr *hwmgr, uint32_t index,
>  				uint32_t value, uint32_t mask);
>  
> -extern int phm_wait_for_register_unequal(struct pp_hwmgr *hwmgr,
> -				uint32_t index, uint32_t value, uint32_t mask);
>  
> -extern uint32_t phm_read_indirect_register(struct pp_hwmgr *hwmgr,
> -		uint32_t indirect_port, uint32_t index);
> -
> -extern void phm_write_indirect_register(struct pp_hwmgr *hwmgr,
> -		uint32_t indirect_port,
> -		uint32_t index,
> -		uint32_t value);
>  
>  extern void phm_wait_on_indirect_register(struct pp_hwmgr *hwmgr,
>  				uint32_t indirect_port,
> @@ -656,12 +647,7 @@ extern void phm_wait_on_indirect_register(struct pp_hwmgr *hwmgr,
>  				uint32_t value,
>  				uint32_t mask);
>  
> -extern void phm_wait_for_indirect_register_unequal(
> -				struct pp_hwmgr *hwmgr,
> -				uint32_t indirect_port,
> -				uint32_t index,
> -				uint32_t value,
> -				uint32_t mask);
> +
>  
>  extern bool phm_cf_want_uvd_power_gating(struct pp_hwmgr *hwmgr);
>  extern bool phm_cf_want_vce_power_gating(struct pp_hwmgr *hwmgr);
> @@ -699,43 +685,7 @@ extern void phm_apply_dal_min_voltage_request(struct pp_hwmgr *hwmgr);
>  	 PHM_FIELD_SHIFT(reg, field))
>  
>  
> -#define PHM_WAIT_REGISTER_GIVEN_INDEX(hwmgr, index, value, mask)	\
> -	phm_wait_on_register(hwmgr, index, value, mask)
> -
> -#define PHM_WAIT_REGISTER_UNEQUAL_GIVEN_INDEX(hwmgr, index, value, mask)	\
> -	phm_wait_for_register_unequal(hwmgr, index, value, mask)
> -
> -#define PHM_WAIT_INDIRECT_REGISTER_GIVEN_INDEX(hwmgr, port, index, value, mask)	\
> -	phm_wait_on_indirect_register(hwmgr, mm##port##_INDEX, index, value, mask)
> -
> -#define PHM_WAIT_INDIRECT_REGISTER_UNEQUAL_GIVEN_INDEX(hwmgr, port, index, value, mask)	\
> -	phm_wait_for_indirect_register_unequal(hwmgr, mm##port##_INDEX, index, value, mask)
>  
> -#define PHM_WAIT_VFPF_INDIRECT_REGISTER_GIVEN_INDEX(hwmgr, port, index, value, mask)	\
> -	phm_wait_on_indirect_register(hwmgr, mm##port##_INDEX_0, index, value, mask)
> -
> -#define PHM_WAIT_VFPF_INDIRECT_REGISTER_UNEQUAL_GIVEN_INDEX(hwmgr, port, index, value, mask)	\
> -	phm_wait_for_indirect_register_unequal(hwmgr, mm##port##_INDEX_0, index, value, mask)
> -
> -/* Operations on named registers. */
> -
> -#define PHM_WAIT_REGISTER(hwmgr, reg, value, mask)	\
> -	PHM_WAIT_REGISTER_GIVEN_INDEX(hwmgr, mm##reg, value, mask)
> -
> -#define PHM_WAIT_REGISTER_UNEQUAL(hwmgr, reg, value, mask)	\
> -	PHM_WAIT_REGISTER_UNEQUAL_GIVEN_INDEX(hwmgr, mm##reg, value, mask)
> -
> -#define PHM_WAIT_INDIRECT_REGISTER(hwmgr, port, reg, value, mask)	\
> -	PHM_WAIT_INDIRECT_REGISTER_GIVEN_INDEX(hwmgr, port, ix##reg, value, mask)
> -
> -#define PHM_WAIT_INDIRECT_REGISTER_UNEQUAL(hwmgr, port, reg, value, mask)	\
> -	PHM_WAIT_INDIRECT_REGISTER_UNEQUAL_GIVEN_INDEX(hwmgr, port, ix##reg, value, mask)
> -
> -#define PHM_WAIT_VFPF_INDIRECT_REGISTER(hwmgr, port, reg, value, mask)	\
> -	PHM_WAIT_VFPF_INDIRECT_REGISTER_GIVEN_INDEX(hwmgr, port, ix##reg, value, mask)
> -
> -#define PHM_WAIT_VFPF_INDIRECT_REGISTER_UNEQUAL(hwmgr, port, reg, value, mask)	\
> -	PHM_WAIT_VFPF_INDIRECT_REGISTER_UNEQUAL_GIVEN_INDEX(hwmgr, port, ix##reg, value, mask)
>  
>  /* Operations on named fields. */
>  
> @@ -764,60 +714,16 @@ extern void phm_apply_dal_min_voltage_request(struct pp_hwmgr *hwmgr);
>  			PHM_SET_FIELD(cgs_read_ind_register(device, port, ix##reg),	\
>  				reg, field, fieldval))
>  
> -#define PHM_WAIT_FIELD(hwmgr, reg, field, fieldval)	\
> -	PHM_WAIT_REGISTER(hwmgr, reg, (fieldval)	\
> -			<< PHM_FIELD_SHIFT(reg, field), PHM_FIELD_MASK(reg, field))
> -
> -#define PHM_WAIT_INDIRECT_FIELD(hwmgr, port, reg, field, fieldval)	\
> -	PHM_WAIT_INDIRECT_REGISTER(hwmgr, port, reg, (fieldval)	\
> -			<< PHM_FIELD_SHIFT(reg, field), PHM_FIELD_MASK(reg, field))
> +#define PHM_WAIT_INDIRECT_REGISTER_GIVEN_INDEX(hwmgr, port, index, value, mask)        \
> +       phm_wait_on_indirect_register(hwmgr, mm##port##_INDEX, index, value, mask)
>  
> -#define PHM_WAIT_VFPF_INDIRECT_FIELD(hwmgr, port, reg, field, fieldval)	\
> -	PHM_WAIT_VFPF_INDIRECT_REGISTER(hwmgr, port, reg, (fieldval)	\
> -			<< PHM_FIELD_SHIFT(reg, field), PHM_FIELD_MASK(reg, field))
>  
> -#define PHM_WAIT_FIELD_UNEQUAL(hwmgr, reg, field, fieldval)	\
> -	PHM_WAIT_REGISTER_UNEQUAL(hwmgr, reg, (fieldval)	\
> -			<< PHM_FIELD_SHIFT(reg, field), PHM_FIELD_MASK(reg, field))
> -
> -#define PHM_WAIT_INDIRECT_FIELD_UNEQUAL(hwmgr, port, reg, field, fieldval)	\
> -	PHM_WAIT_INDIRECT_REGISTER_UNEQUAL(hwmgr, port, reg, (fieldval)	\
> -			<< PHM_FIELD_SHIFT(reg, field), PHM_FIELD_MASK(reg, field))
> +#define PHM_WAIT_INDIRECT_REGISTER(hwmgr, port, reg, value, mask)      \
> +       PHM_WAIT_INDIRECT_REGISTER_GIVEN_INDEX(hwmgr, port, ix##reg, value, mask)
>  
> -#define PHM_WAIT_VFPF_INDIRECT_FIELD_UNEQUAL(hwmgr, port, reg, field, fieldval)	\
> -	PHM_WAIT_VFPF_INDIRECT_REGISTER_UNEQUAL(hwmgr, port, reg, (fieldval)	\
> +#define PHM_WAIT_INDIRECT_FIELD(hwmgr, port, reg, field, fieldval)	\
> +	PHM_WAIT_INDIRECT_REGISTER(hwmgr, port, reg, (fieldval)	\
>  			<< PHM_FIELD_SHIFT(reg, field), PHM_FIELD_MASK(reg, field))
>  
> -/* Operations on arrays of registers & fields. */
> -
> -#define PHM_READ_ARRAY_REGISTER(device, reg, offset)	\
> -	cgs_read_register(device, mm##reg + (offset))
> -
> -#define PHM_WRITE_ARRAY_REGISTER(device, reg, offset, value)	\
> -	cgs_write_register(device, mm##reg + (offset), value)
> -
> -#define PHM_WAIT_ARRAY_REGISTER(hwmgr, reg, offset, value, mask)	\
> -	PHM_WAIT_REGISTER_GIVEN_INDEX(hwmgr, mm##reg + (offset), value, mask)
> -
> -#define PHM_WAIT_ARRAY_REGISTER_UNEQUAL(hwmgr, reg, offset, value, mask)	\
> -	PHM_WAIT_REGISTER_UNEQUAL_GIVEN_INDEX(hwmgr, mm##reg + (offset), value, mask)
> -
> -#define PHM_READ_ARRAY_FIELD(hwmgr, reg, offset, field) \
> -	PHM_GET_FIELD(PHM_READ_ARRAY_REGISTER(hwmgr->device, reg, offset), reg, field)
> -
> -#define PHM_WRITE_ARRAY_FIELD(hwmgr, reg, offset, field, fieldvalue)	\
> -	PHM_WRITE_ARRAY_REGISTER(hwmgr->device, reg, offset,	\
> -			PHM_SET_FIELD(PHM_READ_ARRAY_REGISTER(hwmgr->device, reg, offset),	\
> -				reg, field, fieldvalue))
> -
> -#define PHM_WAIT_ARRAY_FIELD(hwmgr, reg, offset, field, fieldvalue)	\
> -	PHM_WAIT_REGISTER_GIVEN_INDEX(hwmgr, mm##reg + (offset),	\
> -			(fieldvalue) << PHM_FIELD_SHIFT(reg, field),	\
> -			PHM_FIELD_MASK(reg, field))
> -
> -#define PHM_WAIT_ARRAY_FIELD_UNEQUAL(hwmgr, reg, offset, field, fieldvalue)	\
> -	PHM_WAIT_REGISTER_UNEQUAL_GIVEN_INDEX(hwmgr, mm##reg + (offset),	\
> -			(fieldvalue) << PHM_FIELD_SHIFT(reg, field),	\
> -			PHM_FIELD_MASK(reg, field))
>  
>  #endif /* _HWMGR_H_ */
> 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/amd-gfx/attachments/20160802/133b6c83/attachment.sig>


More information about the amd-gfx mailing list