From patchwork Fri Jul 28 19:31:33 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Deucher X-Patchwork-Id: 9869315 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 604C260382 for ; Fri, 28 Jul 2017 19:34:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5749C2888C for ; Fri, 28 Jul 2017 19:34:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4C20E288CA; Fri, 28 Jul 2017 19:34:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=no version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 488C5288C6 for ; Fri, 28 Jul 2017 19:34:15 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 515732677A3; Fri, 28 Jul 2017 21:32:07 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 85A1926779C; Fri, 28 Jul 2017 21:32:03 +0200 (CEST) Received: from mail-qt0-f196.google.com (mail-qt0-f196.google.com [209.85.216.196]) by alsa0.perex.cz (Postfix) with ESMTP id 50DD4266A51 for ; Fri, 28 Jul 2017 21:31:57 +0200 (CEST) Received: by mail-qt0-f196.google.com with SMTP id d10so12319162qtb.4 for ; Fri, 28 Jul 2017 12:31:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=9/oXDz5M6aUm2C1y/kzeIDFHPJ+X6nVQ2h+uCX/TE14=; b=u+zlUkS8fCmBpS4i9r21+SylCFfL8JSodCZAJULRUXTdAYxMimnD219CaIk0Ee9n6Q J8pkoDhCBe9M0AuYgoCnuHCnvQ6WgPorNFotzdwh1np2RJ1ysCBELRz4h8oVS5ilZtPT yckRvfq9HitiqFg/yhD8ramrdvRrUpvxJmpWhiNH4RztdVp97wuzEXVcOSSMXyOSDndn 0/VkwiPaYOi+wxp0iorUufqhhHuKaOWvOk+MFhMxu2Q3cnNSS0L2M2QtmENIChXIx5y/ 3mDAJ4ZL7noRjTrXiyqz9+UBNLx4kG2qthvyHru+Stty336q6jdwU6tyjmxnx3SH0+DO ps2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=9/oXDz5M6aUm2C1y/kzeIDFHPJ+X6nVQ2h+uCX/TE14=; b=qWQYiAZjiPN9YzikBKlSL+poeWg+ViwOHdeLe1BipRjZsWuPiH0XEK46AetJLbifBh c1ioQLwzim8FfjTuzBxbdH+dQPgU2ikvcpsLHAKPDNj3IvfghZWdjR9q6u6Bu//dxcc8 7VvKcJl4X9aNNhnZVnL5aWEWleKplBzBVKc8b5+dPblm9031s5NFsL7vkBdc3y7qr3Ab cySkYyq6pAINLY5YAEoMFMqYuXzZ/rMtuNlOSUBTxA2G9mmpD7k0LcKA3UEMowHK6xjU pq6Cig04ZOkme6bfahV3IyQZKKlwjtt1EqUAfCzZHQRLVLajCGeiY+tLtohFC8iMJW+G +AOA== X-Gm-Message-State: AIVw110j/XTIZf810ZKOidPbd2ascHdaXCTV+bhO4ALBN48Sw0Ulxxxu PoMQZ0yrksOV6Gea X-Received: by 10.237.33.3 with SMTP id 3mr11751398qtc.63.1501270315116; Fri, 28 Jul 2017 12:31:55 -0700 (PDT) Received: from cm.localdomain (va-67-233-122-109.dhcp.embarqhsd.net. [67.233.122.109]) by smtp.gmail.com with ESMTPSA id j21sm16189153qtc.17.2017.07.28.12.31.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 28 Jul 2017 12:31:54 -0700 (PDT) From: Alex Deucher X-Google-Original-From: Alex Deucher To: dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, alsa-devel@alsa-project.org, airlied@gmail.com, broonie@kernel.org, Vijendar.Mukunda@amd.com, rajeevkumar.linux@gmail.com, perex@perex.cz Date: Fri, 28 Jul 2017 15:31:33 -0400 Message-Id: <1501270294-31153-9-git-send-email-alexander.deucher@amd.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1501270294-31153-1-git-send-email-alexander.deucher@amd.com> References: <1501270294-31153-1-git-send-email-alexander.deucher@amd.com> Cc: tiwai@suse.de, Alex Deucher , lgirdwood@gmail.com Subject: [alsa-devel] [PATCH 8/9 v2] drm/amd/amdgpu: Disabling Power Gating for Stoney platform X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP From: Vijendar Mukunda Power Gating is disabled in Stoney platform. Signed-off-by: Vijendar Mukunda Signed-off-by: Alex Deucher --- v2: added missing changes required for power gating and removed local variable. drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c | 51 ++++++++++++++++++--------------- 1 file changed, 28 insertions(+), 23 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c index 9c0bd6c..ebca223 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c @@ -285,19 +285,20 @@ static int acp_hw_init(void *handle) return 0; else if (r) return r; + if (adev->asic_type != CHIP_STONEY) { + adev->acp.acp_genpd = kzalloc(sizeof(struct acp_pm_domain), GFP_KERNEL); + if (adev->acp.acp_genpd == NULL) + return -ENOMEM; - adev->acp.acp_genpd = kzalloc(sizeof(struct acp_pm_domain), GFP_KERNEL); - if (adev->acp.acp_genpd == NULL) - return -ENOMEM; - - adev->acp.acp_genpd->gpd.name = "ACP_AUDIO"; - adev->acp.acp_genpd->gpd.power_off = acp_poweroff; - adev->acp.acp_genpd->gpd.power_on = acp_poweron; + adev->acp.acp_genpd->gpd.name = "ACP_AUDIO"; + adev->acp.acp_genpd->gpd.power_off = acp_poweroff; + adev->acp.acp_genpd->gpd.power_on = acp_poweron; - adev->acp.acp_genpd->cgs_dev = adev->acp.cgs_device; + adev->acp.acp_genpd->cgs_dev = adev->acp.cgs_device; - pm_genpd_init(&adev->acp.acp_genpd->gpd, NULL, false); + pm_genpd_init(&adev->acp.acp_genpd->gpd, NULL, false); + } adev->acp.acp_cell = kzalloc(sizeof(struct mfd_cell) * ACP_DEVS, GFP_KERNEL); @@ -390,12 +391,14 @@ static int acp_hw_init(void *handle) if (r) return r; - for (i = 0; i < ACP_DEVS ; i++) { - dev = get_mfd_cell_dev(adev->acp.acp_cell[i].name, i); - r = pm_genpd_add_device(&adev->acp.acp_genpd->gpd, dev); - if (r) { - dev_err(dev, "Failed to add dev to genpd\n"); - return r; + if (adev->asic_type != CHIP_STONEY) { + for (i = 0; i < ACP_DEVS ; i++) { + dev = get_mfd_cell_dev(adev->acp.acp_cell[i].name, i); + r = pm_genpd_add_device(&adev->acp.acp_genpd->gpd, dev); + if (r) { + dev_err(dev, "Failed to add dev to genpd\n"); + return r; + } } } @@ -415,20 +418,22 @@ static int acp_hw_fini(void *handle) struct amdgpu_device *adev = (struct amdgpu_device *)handle; /* return early if no ACP */ - if (!adev->acp.acp_genpd) + if (!adev->acp.acp_cell) return 0; - for (i = 0; i < ACP_DEVS ; i++) { - dev = get_mfd_cell_dev(adev->acp.acp_cell[i].name, i); - ret = pm_genpd_remove_device(&adev->acp.acp_genpd->gpd, dev); - /* If removal fails, dont giveup and try rest */ - if (ret) - dev_err(dev, "remove dev from genpd failed\n"); + if (adev->acp.acp_genpd) { + for (i = 0; i < ACP_DEVS ; i++) { + dev = get_mfd_cell_dev(adev->acp.acp_cell[i].name, i); + ret = pm_genpd_remove_device(&adev->acp.acp_genpd->gpd, dev); + /* If removal fails, dont giveup and try rest */ + if (ret) + dev_err(dev, "remove dev from genpd failed\n"); + } + kfree(adev->acp.acp_genpd); } mfd_remove_devices(adev->acp.parent); kfree(adev->acp.acp_res); - kfree(adev->acp.acp_genpd); kfree(adev->acp.acp_cell); return 0;