[PATCH 2/2] drm/amd/powerplay: report correct AC/DC event based on ctxid

Alex Deucher alexdeucher at gmail.com
Fri May 8 17:04:31 UTC 2020


On Fri, May 8, 2020 at 6:03 AM Evan Quan <evan.quan at amd.com> wrote:
>
> 'ctxid' is used to distinguish different events raised from SMC.
> 0x3 and 0x4 are for AC and DC power mode.
>
> Change-Id: I7dbcb053fe9cea7c70e0a33afc2115b3745f6186
> Signed-off-by: Evan Quan <evan.quan at amd.com>
> ---
>  drivers/gpu/drm/amd/powerplay/smu_v11_0.c | 15 +++++++++++++--
>  1 file changed, 13 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/powerplay/smu_v11_0.c b/drivers/gpu/drm/amd/powerplay/smu_v11_0.c
> index ab727f33b8d9..dcd3a54d18a3 100644
> --- a/drivers/gpu/drm/amd/powerplay/smu_v11_0.c
> +++ b/drivers/gpu/drm/amd/powerplay/smu_v11_0.c
> @@ -1522,6 +1522,7 @@ static int smu_v11_0_irq_process(struct amdgpu_device *adev,
>  {
>         uint32_t client_id = entry->client_id;
>         uint32_t src_id = entry->src_id;
> +       uint32_t ctxid = entry->ctxid;

As noted by Christian, just use the entry->src_data[0] directly.

>
>         if (client_id == SOC15_IH_CLIENTID_THM) {
>                 switch (src_id) {
> @@ -1547,8 +1548,18 @@ static int smu_v11_0_irq_process(struct amdgpu_device *adev,
>
>                 }
>         } else if (client_id == SOC15_IH_CLIENTID_MP1) {
> -               if (src_id == 0xfe)
> -                       smu_v11_0_ack_ac_dc_interrupt(&adev->smu);
> +               if (src_id == 0xfe) {
> +                       switch (ctxid) {
> +                       case 0x3:
> +                               dev_info(adev->dev, "Switched to AC mode!\n");
> +                               smu_v11_0_ack_ac_dc_interrupt(&adev->smu);
> +                               break;
> +                       case 0x4:
> +                               dev_info(adev->dev, "Switched to DC mode!\n");

Might want to make these dev_debug so we don't spam the logs.  With
those fixed, patch is:
Reviewed-by: Alex Deucher <alexander.deucher at amd.com>

> +                               smu_v11_0_ack_ac_dc_interrupt(&adev->smu);
> +                               break;
> +                       }
> +               }
>         }
>
>         return 0;
> --
> 2.26.2
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx


More information about the amd-gfx mailing list