All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Deucher, Alexander" <Alexander.Deucher-5C7GfCeVMHo@public.gmane.org>
To: "amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org"
	<amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org>
Cc: "Zhang, Jerry" <Jerry.Zhang-5C7GfCeVMHo@public.gmane.org>,
	"Quan, Evan" <Evan.Quan-5C7GfCeVMHo@public.gmane.org>
Subject: RE: [PATCH 4/4] drm/amd/powerplay: get raven sclk and mclk levels
Date: Sat, 30 Sep 2017 01:35:15 +0000	[thread overview]
Message-ID: <BN6PR12MB1652E7D0837BD0B388270443F77F0@BN6PR12MB1652.namprd12.prod.outlook.com> (raw)
In-Reply-To: <1506733818-4712-4-git-send-email-evan.quan-5C7GfCeVMHo@public.gmane.org>

> -----Original Message-----
> From: Evan Quan [mailto:evan.quan@amd.com]
> Sent: Friday, September 29, 2017 9:10 PM
> To: amd-gfx@lists.freedesktop.org
> Cc: Deucher, Alexander; Zhang, Jerry; Quan, Evan
> Subject: [PATCH 4/4] drm/amd/powerplay: get raven sclk and mclk levels
> 

Add a better patch description.  Something like:
Add query for sclk and mclk to the sysfs interface.

> Change-Id: I40fa698cd9a25df43aa4bf476c4aa0a8b043edf9
> Signed-off-by: Evan Quan <evan.quan@amd.com>
> ---
>  drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c | 48
> +++++++++++++++++++++++++-
>  1 file changed, 47 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c
> b/drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c
> index a20a6fe..5135328 100644
> --- a/drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c
> +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/rv_hwmgr.c
> @@ -619,7 +619,53 @@ static int rv_force_clock_level(struct pp_hwmgr
> *hwmgr,
>  static int rv_print_clock_levels(struct pp_hwmgr *hwmgr,
>  		enum pp_clock_type type, char *buf)
>  {
> -	return 0;
> +	struct rv_hwmgr *data = (struct rv_hwmgr *)(hwmgr->backend);
> +	struct rv_voltage_dependency_table *mclk_table =
> +			data->clock_vol_info.vdd_dep_on_fclk;
> +	int i, now, size = 0;
> +
> +	switch (type) {
> +	case PP_SCLK:
> +
> 	PP_ASSERT_WITH_CODE(!smum_send_msg_to_smc(hwmgr-
> >smumgr,
> +				PPSMC_MSG_GetGfxclkFrequency),
> +				"Attempt to get current GFXCLK Failed!",
> +				return -1);
> +		PP_ASSERT_WITH_CODE(!rv_read_arg_from_smc(hwmgr-
> >smumgr,
> +				&now),
> +				"Attempt to get current GFXCLK Failed!",
> +				return -1);
> +
> +		size += sprintf(buf + size, "0: %uMhz %s\n",
> +				data->gfx_min_freq_limit / 100,
> +				((data->gfx_min_freq_limit / 100)
> +				 == now) ? "*" : "");
> +		size += sprintf(buf + size, "1: %uMhz %s\n",
> +				data->gfx_max_freq_limit / 100,
> +				((data->gfx_max_freq_limit / 100)
> +				 == now) ? "*" : "");
> +		break;
> +	case PP_MCLK:
> +
> 	PP_ASSERT_WITH_CODE(!smum_send_msg_to_smc(hwmgr-
> >smumgr,
> +				PPSMC_MSG_GetFclkFrequency),
> +				"Attempt to get current MEMCLK Failed!",
> +				return -1);
> +		PP_ASSERT_WITH_CODE(!rv_read_arg_from_smc(hwmgr-
> >smumgr,
> +				&now),
> +				"Attempt to get current MEMCLK Failed!",
> +				return -1);

Return proper error codes in this function.

With the above comments fixed:
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

> +
> +		for (i = 0; i < mclk_table->count; i++)
> +			size += sprintf(buf + size, "%d: %uMhz %s\n",
> +					i,
> +					mclk_table->entries[i].clk / 100,
> +					((mclk_table->entries[i].clk / 100)
> +					 == now) ? "*" : "");
> +		break;
> +	default:
> +		break;
> +	}
> +
> +	return size;
>  }
> 
>  static int rv_get_performance_level(struct pp_hwmgr *hwmgr, const struct
> pp_hw_power_state *state,
> --
> 2.7.4

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

  parent reply	other threads:[~2017-09-30  1:35 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-30  1:10 [PATCH 1/4] drm/amd/powerplay: added new raven ppsmc messages Evan Quan
     [not found] ` <1506733818-4712-1-git-send-email-evan.quan-5C7GfCeVMHo@public.gmane.org>
2017-09-30  1:10   ` [PATCH 2/4] drm/amd/powerplay: get raven max/min gfx clocks Evan Quan
     [not found]     ` <1506733818-4712-2-git-send-email-evan.quan-5C7GfCeVMHo@public.gmane.org>
2017-09-30  1:28       ` Deucher, Alexander
2017-09-30  1:10   ` [PATCH 3/4] drm/amd/powerplay: get raven current sclk and mclk Evan Quan
     [not found]     ` <1506733818-4712-3-git-send-email-evan.quan-5C7GfCeVMHo@public.gmane.org>
2017-09-30  1:32       ` Deucher, Alexander
2017-09-30  1:10   ` [PATCH 4/4] drm/amd/powerplay: get raven sclk and mclk levels Evan Quan
     [not found]     ` <1506733818-4712-4-git-send-email-evan.quan-5C7GfCeVMHo@public.gmane.org>
2017-09-30  1:35       ` Deucher, Alexander [this message]
2017-09-30  1:28   ` [PATCH 1/4] drm/amd/powerplay: added new raven ppsmc messages Zhang, Jerry (Junwei)
2017-09-30  1:30   ` Deucher, Alexander

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=BN6PR12MB1652E7D0837BD0B388270443F77F0@BN6PR12MB1652.namprd12.prod.outlook.com \
    --to=alexander.deucher-5c7gfcevmho@public.gmane.org \
    --cc=Evan.Quan-5C7GfCeVMHo@public.gmane.org \
    --cc=Jerry.Zhang-5C7GfCeVMHo@public.gmane.org \
    --cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.