All of lore.kernel.org
 help / color / mirror / Atom feed
From: Grazvydas Ignotas <notasas-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Rex Zhu <Rex.Zhu-5C7GfCeVMHo@public.gmane.org>
Cc: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Subject: Re: [PATCH 2/2] drm/amd/pp: Add custom power profile mode support on Vega10
Date: Wed, 10 Jan 2018 14:12:02 +0200	[thread overview]
Message-ID: <CANOLnOP7QtjAcos9RZ=PjzWX+amHyq_sPtmBD4zd02yoJ5hEQg@mail.gmail.com> (raw)
In-Reply-To: <1515582075-6326-2-git-send-email-Rex.Zhu-5C7GfCeVMHo@public.gmane.org>

On Wed, Jan 10, 2018 at 1:01 PM, Rex Zhu <Rex.Zhu@amd.com> wrote:
> Change-Id: I0a554cb6a7a56db63a8fc5af60d5c63f65e021d1
> Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
> ---
>  drivers/gpu/drm/amd/powerplay/amd_powerplay.c      | 39 +++++++++++
>  drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c | 78 ++++++++++++++++++++++
>  drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.h |  1 +
>  drivers/gpu/drm/amd/powerplay/inc/hwmgr.h          |  3 +
>  4 files changed, 121 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/powerplay/amd_powerplay.c b/drivers/gpu/drm/amd/powerplay/amd_powerplay.c
> index 8859b67..3493292 100644
> --- a/drivers/gpu/drm/amd/powerplay/amd_powerplay.c
> +++ b/drivers/gpu/drm/amd/powerplay/amd_powerplay.c
> @@ -1081,6 +1081,43 @@ static int pp_dpm_get_power_profile_state(void *handle,
>         return 0;
>  }
>
> +static int pp_get_power_profile_mode(void *handle, char *buf)
> +{
> +       struct pp_hwmgr *hwmgr;
> +       struct pp_instance *pp_handle = (struct pp_instance *)handle;
> +
> +       if (!buf || pp_check(pp_handle))
> +               return -EINVAL;
> +
> +       hwmgr = pp_handle->hwmgr;
> +
> +       if (hwmgr->hwmgr_func->get_power_profile_mode == NULL) {
> +               pr_info("%s was not implemented.\n", __func__);
> +               return snprintf(buf, PAGE_SIZE, "\n");
> +       }
> +
> +       return hwmgr->hwmgr_func->get_power_profile_mode(hwmgr, buf);
> +}
> +
> +static int pp_set_power_profile_mode(void *handle, long *input, uint32_t size)
> +{
> +       struct pp_hwmgr *hwmgr;
> +       struct pp_instance *pp_handle = (struct pp_instance *)handle;
> +
> +

Unnecessary blank line.

> +       if (pp_check(pp_handle))
> +               return -EINVAL;
> +
> +       hwmgr = pp_handle->hwmgr;
> +
> +       if (hwmgr->hwmgr_func->set_power_profile_mode == NULL) {
> +               pr_info("%s was not implemented.\n", __func__);
> +               return -EINVAL;
> +       }
> +
> +       return hwmgr->hwmgr_func->set_power_profile_mode(hwmgr, input, size);
> +}
> +
>  static int pp_dpm_set_power_profile_state(void *handle,
>                 struct amd_pp_profile *request)
>  {
> @@ -1464,6 +1501,8 @@ static int pp_get_display_mode_validation_clocks(void *handle,
>         .switch_power_profile = pp_dpm_switch_power_profile,
>         .set_clockgating_by_smu = pp_set_clockgating_by_smu,
>         .notify_smu_memory_info = pp_dpm_notify_smu_memory_info,
> +       .get_power_profile_mode = pp_get_power_profile_mode,
> +       .set_power_profile_mode = pp_set_power_profile_mode,
>  /* export to DC */
>         .get_sclk = pp_dpm_get_sclk,
>         .get_mclk = pp_dpm_get_mclk,
> diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c
> index 23b7239..e8b6c3d 100644
> --- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c
> +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c
> @@ -757,6 +757,8 @@ static int vega10_hwmgr_backend_init(struct pp_hwmgr *hwmgr)
>
>         hwmgr->backend = data;
>
> +       hwmgr->power_profile_mode = PP_SMC_POWER_PROFILE_VIDEO;
> +
>         vega10_set_default_registry_data(hwmgr);
>
>         data->disable_dpm_mask = 0xff;
> @@ -3950,6 +3952,7 @@ static int vega10_read_sensor(struct pp_hwmgr *hwmgr, int idx,
>                 ret = -EINVAL;
>                 break;
>         }
> +
>         return ret;
>  }
>
> @@ -5008,6 +5011,79 @@ static int vega10_register_thermal_interrupt(struct pp_hwmgr *hwmgr,
>         return 0;
>  }
>
> +static int vega10_get_power_profile_mode(struct pp_hwmgr *hwmgr, char *buf)
> +{
> +       struct vega10_hwmgr *data = (struct vega10_hwmgr *)(hwmgr->backend);
> +       uint32_t i, size = 0;
> +       uint8_t profile_mode_setting[5][4] = {{70, 60, 1, 3,},

static const, otherwise the compiler has to copy the table to stack on
every call.

> +                                               {90, 60, 0, 0,},
> +                                               {70, 60, 0, 0,},
> +                                               {70, 90, 0, 0,},
> +                                               {30, 60, 0, 6,},
> +                                               };
> +       char *profile_name[6] = {"3D_FULL_SCREEN",

static const char * const profile_name[6] = ...

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

  parent reply	other threads:[~2018-01-10 12:12 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-10 11:01 [PATCH 1/2] drm/amdgpu: add custom power policy support in sysfs Rex Zhu
     [not found] ` <1515582075-6326-1-git-send-email-Rex.Zhu-5C7GfCeVMHo@public.gmane.org>
2018-01-10 11:01   ` [PATCH 2/2] drm/amd/pp: Add custom power profile mode support on Vega10 Rex Zhu
     [not found]     ` <1515582075-6326-2-git-send-email-Rex.Zhu-5C7GfCeVMHo@public.gmane.org>
2018-01-10 12:12       ` Grazvydas Ignotas [this message]
2018-01-10 20:18   ` [PATCH 1/2] drm/amdgpu: add custom power policy support in sysfs Alex Deucher
     [not found]     ` <CADnq5_PEegETmiiS+itf-HJKYH6ZeK7DEh6yJQc1kP-o7k+raA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-01-10 22:33       ` Zhu, Rex
2018-01-16 11:50 Rex Zhu
     [not found] ` <1516103404-24914-1-git-send-email-Rex.Zhu-5C7GfCeVMHo@public.gmane.org>
2018-01-16 11:50   ` [PATCH 2/2] drm/amd/pp: Add custom power profile mode support on Vega10 Rex Zhu
     [not found]     ` <1516103404-24914-2-git-send-email-Rex.Zhu-5C7GfCeVMHo@public.gmane.org>
2018-01-16 15:59       ` Alex Deucher

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='CANOLnOP7QtjAcos9RZ=PjzWX+amHyq_sPtmBD4zd02yoJ5hEQg@mail.gmail.com' \
    --to=notasas-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=Rex.Zhu-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.