<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-2022-jp">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
comment inline.</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> amd-gfx <amd-gfx-bounces@lists.freedesktop.org> on behalf of Quan, Evan <Evan.Quan@amd.com><br>
<b>Sent:</b> Monday, September 9, 2019 4:31 PM<br>
<b>To:</b> Liang, Prike <Prike.Liang@amd.com>; amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org><br>
<b>Cc:</b> Huang, Ray <Ray.Huang@amd.com>; Feng, Kenneth <Kenneth.Feng@amd.com>; Liu, Aaron <Aaron.Liu@amd.com><br>
<b>Subject:</b> RE: [PATCH] drm/amd/powerplay: Add the interface for geting dpm current power state</font>
<div>
<div style="margin: 0px; font-size: 12pt; font-family: Calibri, Arial, Helvetica, sans-serif; color: rgb(0, 0, 0)">
<br>
</div>
</div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt">
<div class="PlainText">Reviewed-by: Evan Quan <evan.quan@amd.com><br>
<br>
> -----Original Message-----<br>
> From: Liang, Prike <Prike.Liang@amd.com><br>
> Sent: 2019年9月9日 13:22<br>
> To: amd-gfx@lists.freedesktop.org<br>
> Cc: Quan, Evan <Evan.Quan@amd.com>; Feng, Kenneth<br>
> <Kenneth.Feng@amd.com>; Huang, Ray <Ray.Huang@amd.com>; Liu, Aaron<br>
> <Aaron.Liu@amd.com>; Liang, Prike <Prike.Liang@amd.com><br>
> Subject: [PATCH] drm/amd/powerplay: Add the interface for geting dpm<br>
> current power state<br>
> <br>
> implement the sysfs power_dpm_state<br>
> <br>
> Signed-off-by: Prike Liang <Prike.Liang@amd.com><br>
> ---<br>
>  drivers/gpu/drm/amd/powerplay/renoir_ppt.c | 34<br>
> ++++++++++++++++++++++++++++++<br>
>  1 file changed, 34 insertions(+)<br>
> <br>
> diff --git a/drivers/gpu/drm/amd/powerplay/renoir_ppt.c<br>
> b/drivers/gpu/drm/amd/powerplay/renoir_ppt.c<br>
> index a5cf846..2c22ba4 100644<br>
> --- a/drivers/gpu/drm/amd/powerplay/renoir_ppt.c<br>
> +++ b/drivers/gpu/drm/amd/powerplay/renoir_ppt.c<br>
> @@ -246,6 +246,38 @@ static int renoir_print_clk_levels(struct smu_context<br>
> *smu,<br>
>        return size;<br>
>  }<br>
> <br>
> +static enum amd_pm_state_type renoir_get_current_power_state(struct<br>
> +smu_context *smu) {<br>
> +     enum amd_pm_state_type pm_type;<br>
> +     struct smu_dpm_context *smu_dpm_ctx = &(smu->smu_dpm);<br>
> +<br>
> +     if (!smu_dpm_ctx->dpm_context ||<br>
> +         !smu_dpm_ctx->dpm_current_power_state)<br>
> +             return -EINVAL;<br>
> +<br>
> +     mutex_lock(&(smu->mutex));<br>
> +     switch (smu_dpm_ctx->dpm_current_power_state-<br>
> >classification.ui_label) {<br>
> +     case SMU_STATE_UI_LABEL_BATTERY:<br>
> +             pm_type = POWER_STATE_TYPE_BATTERY;<br>
> +             break;<br>
> +     case SMU_STATE_UI_LABEL_BALLANCED:<br>
> +             pm_type = POWER_STATE_TYPE_BALANCED;<br>
> +             break;<br>
> +     case SMU_STATE_UI_LABEL_PERFORMANCE:<br>
> +             pm_type = POWER_STATE_TYPE_PERFORMANCE;<br>
> +             break;<br>
> +     default:<br>
> +             if (smu_dpm_ctx->dpm_current_power_state-<br>
> >classification.flags & SMU_STATE_CLASSIFICATION_FLAG_BOOT)<br>
> +                     pm_type = POWER_STATE_TYPE_INTERNAL_BOOT;<br>
> +             else<br>
> +                     pm_type = POWER_STATE_TYPE_DEFAULT;<br>
> +             break;<br>
> +     }<br>
> +     mutex_unlock(&(smu->mutex));<br>
> +<br>
> +     return pm_type;<br>
> +}<br>
> +<br>
>  static const struct pptable_funcs renoir_ppt_funcs = {<br>
>        .get_smu_msg_index = renoir_get_smu_msg_index,<br>
>        .get_smu_table_index = renoir_get_smu_table_index, @@ -253,6<br>
> +285,8 @@ static const struct pptable_funcs renoir_ppt_funcs = {<br>
>        .set_power_state = NULL,<br>
>        .get_dpm_uclk_limited = renoir_get_dpm_uclk_limited,<br>
>        .print_clk_levels = renoir_print_clk_levels,<br>
> +     .get_current_power_state = renoir_get_current_power_state,<br>
> +</div>
<div class="PlainText"><b>[kevin]:</b></div>
<div class="PlainText"><b>please remove this blank line.</b></div>
<div class="PlainText"><b>after fixed:</b></div>
<div class="PlainText"><b>Reviewed-by: Kevin wang <kevin1.wang@amd.com></b></div>
<div class="PlainText">>  };<br>
> <br>
>  void renoir_set_ppt_funcs(struct smu_context *smu)<br>
> --<br>
> 2.7.4<br>
<br>
_______________________________________________<br>
amd-gfx mailing list<br>
amd-gfx@lists.freedesktop.org<br>
<a href="https://lists.freedesktop.org/mailman/listinfo/amd-gfx">https://lists.freedesktop.org/mailman/listinfo/amd-gfx</a></div>
</span></font></div>
</body>
</html>