From patchwork Tue Jan 22 07:33:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sameer Pujar X-Patchwork-Id: 10775009 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9B95191E for ; Tue, 22 Jan 2019 07:33:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8719C2A937 for ; Tue, 22 Jan 2019 07:33:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7B5A12A93A; Tue, 22 Jan 2019 07:33:47 +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=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham 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 25DE52A937 for ; Tue, 22 Jan 2019 07:33:46 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 2921526749D; Tue, 22 Jan 2019 08:33:45 +0100 (CET) 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 2406526749F; Tue, 22 Jan 2019 08:33:42 +0100 (CET) Received: from hqemgate15.nvidia.com (hqemgate15.nvidia.com [216.228.121.64]) by alsa0.perex.cz (Postfix) with ESMTP id A19862667E7 for ; Tue, 22 Jan 2019 08:33:39 +0100 (CET) Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqemgate15.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Mon, 21 Jan 2019 23:33:15 -0800 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Mon, 21 Jan 2019 23:33:38 -0800 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Mon, 21 Jan 2019 23:33:38 -0800 Received: from HQMAIL112.nvidia.com (172.18.146.18) by HQMAIL103.nvidia.com (172.20.187.11) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Tue, 22 Jan 2019 07:33:38 +0000 Received: from HQMAIL101.nvidia.com (172.20.187.10) by HQMAIL112.nvidia.com (172.18.146.18) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Tue, 22 Jan 2019 07:33:38 +0000 Received: from hqnvemgw01.nvidia.com (172.20.150.20) by HQMAIL101.nvidia.com (172.20.187.10) with Microsoft SMTP Server (TLS) id 15.0.1395.4 via Frontend Transport; Tue, 22 Jan 2019 07:33:38 +0000 Received: from linux.nvidia.com (Not Verified[10.24.34.185]) by hqnvemgw01.nvidia.com with Trustwave SEG (v7, 5, 8, 10121) id ; Mon, 21 Jan 2019 23:33:37 -0800 From: Sameer Pujar To: , , Date: Tue, 22 Jan 2019 13:03:16 +0530 Message-ID: <1548142401-22841-2-git-send-email-spujar@nvidia.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1548142401-22841-1-git-send-email-spujar@nvidia.com> References: <1548142401-22841-1-git-send-email-spujar@nvidia.com> MIME-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1548142395; bh=GUfcp3zF9ogZty+ACWQCtTuuw0Uw6oXnH6lFKTnHGYI=; h=X-PGP-Universal:From:To:CC:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:MIME-Version:Content-Type; b=AvJXgxbu+bQmaUodo7orOUDrgpGjwMwhw68CeDYzBhftBb5XKLbStwR7VNbxMFYHP GI0fScMksYDpwJnmF9/YL5J6uMbFgbc2KlSoLJdQ1zoxN7NDQAz3q1Ap3UpmkIdG4H ZSAdy1AkZ+vSTZU93abVIvyosjl3cu/kN6v/KE+KXYVweOI/qbgu8AYJ87sRvy/X8k eypMcqzOm4xx8zZJdoeJ6xEmxz9WNJE5WggX5Vn4uUmsir761UjKUktdKAGSsJOUXe 4W2RBeG0ecV1/wfArRgP/+AhSPSq7HUh3qP8BevxGhgPfRWlvLdOudoZxvqcWqramE 4L8NZLFTmcjog== Cc: alsa-devel@alsa-project.org, Sameer Pujar Subject: [alsa-devel] [PATCH v2 1/6] ALSA: hda/tegra: runtime power management support 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP This patch enables runtime power management(runtime PM) support for hda. pm_runtime_enable() and pm_runtime_disable() are added during device probe and remove respectively. The runtime PM callbacks will be forbidden if hda controller does not have support for runtime PM. pm_runtime_get_sync() and pm_runtime_put() are added for hda register access. The callbacks for above will be added in subsequent patches. Signed-off-by: Sameer Pujar Reviewed-by: Ravindra Lokhande Reviewed-by: Mohan Kumar D --- sound/pci/hda/hda_tegra.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/sound/pci/hda/hda_tegra.c b/sound/pci/hda/hda_tegra.c index 97a176d..2f9dd23 100644 --- a/sound/pci/hda/hda_tegra.c +++ b/sound/pci/hda/hda_tegra.c @@ -32,6 +32,7 @@ #include #include #include +#include #include #include @@ -512,6 +513,11 @@ static int hda_tegra_probe(struct platform_device *pdev) card->private_data = chip; dev_set_drvdata(&pdev->dev, card); + + pm_runtime_enable(hda->dev); + if (!azx_has_pm_runtime(chip)) + pm_runtime_forbid(hda->dev); + schedule_work(&hda->probe_work); return 0; @@ -528,6 +534,7 @@ static void hda_tegra_probe_work(struct work_struct *work) struct platform_device *pdev = to_platform_device(hda->dev); int err; + pm_runtime_get_sync(hda->dev); err = hda_tegra_first_init(chip, pdev); if (err < 0) goto out_free; @@ -549,12 +556,18 @@ static void hda_tegra_probe_work(struct work_struct *work) snd_hda_set_power_save(&chip->bus, power_save * 1000); out_free: + pm_runtime_put(hda->dev); return; /* no error return from async probe */ } static int hda_tegra_remove(struct platform_device *pdev) { - return snd_card_free(dev_get_drvdata(&pdev->dev)); + int ret; + + ret = snd_card_free(dev_get_drvdata(&pdev->dev)); + pm_runtime_disable(&pdev->dev); + + return ret; } static void hda_tegra_shutdown(struct platform_device *pdev) From patchwork Tue Jan 22 07:33:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sameer Pujar X-Patchwork-Id: 10775011 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6334E91E for ; Tue, 22 Jan 2019 07:33:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4AF5B20572 for ; Tue, 22 Jan 2019 07:33:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3BCF02239C; Tue, 22 Jan 2019 07:33:56 +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=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham 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 DE16D20572 for ; Tue, 22 Jan 2019 07:33:54 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 1535C2674A8; Tue, 22 Jan 2019 08:33:51 +0100 (CET) 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 8D8962674B8; Tue, 22 Jan 2019 08:33:48 +0100 (CET) Received: from hqemgate16.nvidia.com (hqemgate16.nvidia.com [216.228.121.65]) by alsa0.perex.cz (Postfix) with ESMTP id EF46E2674A5 for ; Tue, 22 Jan 2019 08:33:44 +0100 (CET) Received: from hqpgpgate102.nvidia.com (Not Verified[216.228.121.13]) by hqemgate16.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Mon, 21 Jan 2019 23:33:08 -0800 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate102.nvidia.com (PGP Universal service); Mon, 21 Jan 2019 23:33:42 -0800 X-PGP-Universal: processed; by hqpgpgate102.nvidia.com on Mon, 21 Jan 2019 23:33:42 -0800 Received: from HQMAIL108.nvidia.com (172.18.146.13) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Tue, 22 Jan 2019 07:33:42 +0000 Received: from hqnvemgw01.nvidia.com (172.20.150.20) by HQMAIL108.nvidia.com (172.18.146.13) with Microsoft SMTP Server (TLS) id 15.0.1395.4 via Frontend Transport; Tue, 22 Jan 2019 07:33:42 +0000 Received: from linux.nvidia.com (Not Verified[10.24.34.185]) by hqnvemgw01.nvidia.com with Trustwave SEG (v7, 5, 8, 10121) id ; Mon, 21 Jan 2019 23:33:42 -0800 From: Sameer Pujar To: , , Date: Tue, 22 Jan 2019 13:03:17 +0530 Message-ID: <1548142401-22841-3-git-send-email-spujar@nvidia.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1548142401-22841-1-git-send-email-spujar@nvidia.com> References: <1548142401-22841-1-git-send-email-spujar@nvidia.com> MIME-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1548142388; bh=OE7lc9GUWlA3fupSSB2kye0/00q/wgZOBjJznGm+0nc=; h=X-PGP-Universal:From:To:CC:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:MIME-Version:Content-Type; b=mQOWiAx0l0o79usElo+AKvlTh20mPGvw1QdUqve/BTIK1rycXenWdPGehRSFFYJSW U1Fo83qaFhA60I7WGwPAlMm2/B4pQpkUMNdfGKwpzG9lW14SXh3krYkQTjTx9br0xJ RAgHhVox1DAuPf+c30vZ6DXaXrWaOUHtGy21e4ECka9ZDvKwuTFvAwKgcGNzGPwoHE ArBg961S1g7i04S4KVSDoleHUYX0C7S7Ke2pT0Qo1nCv8UIPFWpiEEBV2EBsQ//ZYe ctxq0dbYXzmiAbh1SQyuxoCqo4RMtKZfvuyF0C5ii1tbTKF7AiWbeidcKSxOkqol+e bd7hhKDzUOBxQ== Cc: alsa-devel@alsa-project.org, Sameer Pujar Subject: [alsa-devel] [PATCH v2 2/6] ALSA: hda/tegra: get clock handles early in probe 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP Moved devm_clk_get() API calls to a separate function and the same can be called early in the probe. This is done before runtime PM for the device is enabled. The runtime resume/suspend callbacks can later enable/disable clocks respectively(the support would be added in subsequent patches). Clock handles should be available by the time runtime suspend/resume calls can happen. Signed-off-by: Sameer Pujar Reviewed-by: Ravindra Lokhande Reviewed-by: Mohan Kumar D --- sound/pci/hda/hda_tegra.c | 43 +++++++++++++++++++++++++++---------------- 1 file changed, 27 insertions(+), 16 deletions(-) diff --git a/sound/pci/hda/hda_tegra.c b/sound/pci/hda/hda_tegra.c index 2f9dd23..28e1656 100644 --- a/sound/pci/hda/hda_tegra.c +++ b/sound/pci/hda/hda_tegra.c @@ -306,22 +306,6 @@ static int hda_tegra_init_chip(struct azx *chip, struct platform_device *pdev) struct resource *res; int err; - hda->hda_clk = devm_clk_get(dev, "hda"); - if (IS_ERR(hda->hda_clk)) { - dev_err(dev, "failed to get hda clock\n"); - return PTR_ERR(hda->hda_clk); - } - hda->hda2codec_2x_clk = devm_clk_get(dev, "hda2codec_2x"); - if (IS_ERR(hda->hda2codec_2x_clk)) { - dev_err(dev, "failed to get hda2codec_2x clock\n"); - return PTR_ERR(hda->hda2codec_2x_clk); - } - hda->hda2hdmi_clk = devm_clk_get(dev, "hda2hdmi"); - if (IS_ERR(hda->hda2hdmi_clk)) { - dev_err(dev, "failed to get hda2hdmi clock\n"); - return PTR_ERR(hda->hda2hdmi_clk); - } - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); hda->regs = devm_ioremap_resource(dev, res); if (IS_ERR(hda->regs)) @@ -341,6 +325,29 @@ static int hda_tegra_init_chip(struct azx *chip, struct platform_device *pdev) return 0; } +static int hda_tegra_init_clk(struct hda_tegra *hda) +{ + struct device *dev = hda->dev; + + hda->hda_clk = devm_clk_get(dev, "hda"); + if (IS_ERR(hda->hda_clk)) { + dev_err(dev, "failed to get hda clock\n"); + return PTR_ERR(hda->hda_clk); + } + hda->hda2codec_2x_clk = devm_clk_get(dev, "hda2codec_2x"); + if (IS_ERR(hda->hda2codec_2x_clk)) { + dev_err(dev, "failed to get hda2codec_2x clock\n"); + return PTR_ERR(hda->hda2codec_2x_clk); + } + hda->hda2hdmi_clk = devm_clk_get(dev, "hda2hdmi"); + if (IS_ERR(hda->hda2hdmi_clk)) { + dev_err(dev, "failed to get hda2hdmi clock\n"); + return PTR_ERR(hda->hda2hdmi_clk); + } + + return 0; +} + static int hda_tegra_first_init(struct azx *chip, struct platform_device *pdev) { struct hdac_bus *bus = azx_bus(chip); @@ -507,6 +514,10 @@ static int hda_tegra_probe(struct platform_device *pdev) return err; } + err = hda_tegra_init_clk(hda); + if (err < 0) + goto out_free; + err = hda_tegra_create(card, driver_flags, hda); if (err < 0) goto out_free; From patchwork Tue Jan 22 07:33:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sameer Pujar X-Patchwork-Id: 10775013 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B88C913B5 for ; Tue, 22 Jan 2019 07:34:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A0E0120572 for ; Tue, 22 Jan 2019 07:34:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 939642239C; Tue, 22 Jan 2019 07:34:03 +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=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham 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 E58F020572 for ; Tue, 22 Jan 2019 07:34:02 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 56F102674C5; Tue, 22 Jan 2019 08:33:53 +0100 (CET) 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 C3F6B2674AD; Tue, 22 Jan 2019 08:33:49 +0100 (CET) Received: from hqemgate16.nvidia.com (hqemgate16.nvidia.com [216.228.121.65]) by alsa0.perex.cz (Postfix) with ESMTP id C39BE2667E7 for ; Tue, 22 Jan 2019 08:33:46 +0100 (CET) Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqemgate16.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Mon, 21 Jan 2019 23:33:11 -0800 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Mon, 21 Jan 2019 23:33:45 -0800 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Mon, 21 Jan 2019 23:33:45 -0800 Received: from HQMAIL107.nvidia.com (172.20.187.13) by HQMAIL103.nvidia.com (172.20.187.11) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Tue, 22 Jan 2019 07:33:44 +0000 Received: from hqnvemgw01.nvidia.com (172.20.150.20) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1395.4 via Frontend Transport; Tue, 22 Jan 2019 07:33:45 +0000 Received: from linux.nvidia.com (Not Verified[10.24.34.185]) by hqnvemgw01.nvidia.com with Trustwave SEG (v7, 5, 8, 10121) id ; Mon, 21 Jan 2019 23:33:45 -0800 From: Sameer Pujar To: , , Date: Tue, 22 Jan 2019 13:03:18 +0530 Message-ID: <1548142401-22841-4-git-send-email-spujar@nvidia.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1548142401-22841-1-git-send-email-spujar@nvidia.com> References: <1548142401-22841-1-git-send-email-spujar@nvidia.com> MIME-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1548142391; bh=Pwgt/mHdvJl0cdImHPccAjuV6aIuNmDnihD4ZZ2zvE4=; h=X-PGP-Universal:From:To:CC:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:MIME-Version:Content-Type; b=nVloqNsZ6mtdS7QchNO4a+VezTAppkTXAQ8iw97ZnOu6nO8ECA7nSD+goC3jGfIhL j/Xka6VjZ+LHGkkRclrDG7uddnXqcTasIOzToYuz7pIVb1xCXMEimyoxYTHVum38JZ 39oRf3OKFF0oMycTIF2bGUj+FXSiEaU2XXUdbNu/QT3MHj4Sgw6IZxYO1pI4iVX75n pjWXpJbxmbsGaIPfVNZzDEDbRnw7fSBuS+jJxHtLzUgdH3dox/AaqUhxtfNh132BWg GGAU1QTkOgR49lowH6x05tJsZV+dxEZpLul0RzmSeYjGsZ9jThV5jo7g14nxM78xtD 98yAKNl5v6gDA== Cc: alsa-devel@alsa-project.org, Sameer Pujar Subject: [alsa-devel] [PATCH v2 3/6] ALSA: hda/tegra: add runtime PM callbacks 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP This patch adds skeleton of runtime suspend and resume callbacks. Signed-off-by: Sameer Pujar Reviewed-by: Ravindra Lokhande Reviewed-by: Mohan Kumar D --- sound/pci/hda/hda_tegra.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/sound/pci/hda/hda_tegra.c b/sound/pci/hda/hda_tegra.c index 28e1656..1189f97 100644 --- a/sound/pci/hda/hda_tegra.c +++ b/sound/pci/hda/hda_tegra.c @@ -265,8 +265,23 @@ static int hda_tegra_resume(struct device *dev) } #endif /* CONFIG_PM_SLEEP */ +#ifdef CONFIG_PM +static int hda_tegra_runtime_suspend(struct device *dev) +{ + return 0; +} + +static int hda_tegra_runtime_resume(struct device *dev) +{ + return 0; +} +#endif /* CONFIG_PM */ + static const struct dev_pm_ops hda_tegra_pm = { SET_SYSTEM_SLEEP_PM_OPS(hda_tegra_suspend, hda_tegra_resume) + SET_RUNTIME_PM_OPS(hda_tegra_runtime_suspend, + hda_tegra_runtime_resume, + NULL) }; static int hda_tegra_dev_disconnect(struct snd_device *device) From patchwork Tue Jan 22 07:33:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sameer Pujar X-Patchwork-Id: 10775015 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 82DBE13B5 for ; Tue, 22 Jan 2019 07:34:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6E4B820572 for ; Tue, 22 Jan 2019 07:34:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 626B42239C; Tue, 22 Jan 2019 07:34:10 +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=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham 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 B347F20572 for ; Tue, 22 Jan 2019 07:34:09 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 1584E2674B3; Tue, 22 Jan 2019 08:33:56 +0100 (CET) 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 566AA2674C0; Tue, 22 Jan 2019 08:33:53 +0100 (CET) Received: from hqemgate16.nvidia.com (hqemgate16.nvidia.com [216.228.121.65]) by alsa0.perex.cz (Postfix) with ESMTP id DB09B26749A for ; Tue, 22 Jan 2019 08:33:49 +0100 (CET) Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqemgate16.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Mon, 21 Jan 2019 23:33:14 -0800 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Mon, 21 Jan 2019 23:33:48 -0800 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Mon, 21 Jan 2019 23:33:48 -0800 Received: from HQMAIL112.nvidia.com (172.18.146.18) by HQMAIL101.nvidia.com (172.20.187.10) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Tue, 22 Jan 2019 07:33:48 +0000 Received: from HQMAIL108.nvidia.com (172.18.146.13) by HQMAIL112.nvidia.com (172.18.146.18) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Tue, 22 Jan 2019 07:33:48 +0000 Received: from hqnvemgw01.nvidia.com (172.20.150.20) by HQMAIL108.nvidia.com (172.18.146.13) with Microsoft SMTP Server (TLS) id 15.0.1395.4 via Frontend Transport; Tue, 22 Jan 2019 07:33:48 +0000 Received: from linux.nvidia.com (Not Verified[10.24.34.185]) by hqnvemgw01.nvidia.com with Trustwave SEG (v7, 5, 8, 10121) id ; Mon, 21 Jan 2019 23:33:48 -0800 From: Sameer Pujar To: , , Date: Tue, 22 Jan 2019 13:03:19 +0530 Message-ID: <1548142401-22841-5-git-send-email-spujar@nvidia.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1548142401-22841-1-git-send-email-spujar@nvidia.com> References: <1548142401-22841-1-git-send-email-spujar@nvidia.com> MIME-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1548142394; bh=7DCcj6mDMPxRCptSsKRdgqb0oLMn5gf2QPWQd0ynMTM=; h=X-PGP-Universal:From:To:CC:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:MIME-Version:Content-Type; b=for/YyTMcaYC40rzzg2BXjwxlb/mKXdCK/LM4OycLY9FgVds/TMHk+qCDJrWehyDC HPJV/hJ3F6VczyW4UI/lJon2BUcW51mIjQJPVVYdMeaOzqJ2fIRZyX+2DQB/OT3rNi V0FpkSeSVmREdG/iK5Z6S3HmTsstJ3yqLVRMFZjKnpSuQw+xddJzFVrLr6r6ZMZsrG REYMqhoG+e2BxolAjTz1wsJTa/Q719G/dl0U4TQUXxNhUWIv0VYYUZotk2rOnkK676 X9IJ3JsOPQ4RCNQkygEaLFzdnp2vqVYN4Frt3lcW/dalf9Ft0NG9GlBx1aC6D35KTQ S76d3IDFCcUUA== Cc: alsa-devel@alsa-project.org, Sameer Pujar Subject: [alsa-devel] [PATCH v2 4/6] ALSA: hda/tegra: remove redundant clock enable API 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP Explicit clock enable is not required during probe, as this would be managed by runtime PM calls. Clock can be enabled/disabled in runtime resume/suspend. This way it is easier to balance clock enable/disable counts. Signed-off-by: Sameer Pujar Reviewed-by: Ravindra Lokhande Reviewed-by: Mohan Kumar D --- sound/pci/hda/hda_tegra.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/sound/pci/hda/hda_tegra.c b/sound/pci/hda/hda_tegra.c index 1189f97..f068b1e 100644 --- a/sound/pci/hda/hda_tegra.c +++ b/sound/pci/hda/hda_tegra.c @@ -319,7 +319,6 @@ static int hda_tegra_init_chip(struct azx *chip, struct platform_device *pdev) struct hdac_bus *bus = azx_bus(chip); struct device *dev = hda->dev; struct resource *res; - int err; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); hda->regs = devm_ioremap_resource(dev, res); @@ -329,12 +328,6 @@ static int hda_tegra_init_chip(struct azx *chip, struct platform_device *pdev) bus->remap_addr = hda->regs + HDA_BAR0; bus->addr = res->start + HDA_BAR0; - err = hda_tegra_enable_clocks(hda); - if (err) { - dev_err(dev, "failed to get enable clocks\n"); - return err; - } - hda_tegra_init(hda); return 0; From patchwork Tue Jan 22 07:33:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sameer Pujar X-Patchwork-Id: 10775017 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9552891E for ; Tue, 22 Jan 2019 07:34:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7F76320572 for ; Tue, 22 Jan 2019 07:34:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 739762239C; Tue, 22 Jan 2019 07:34:17 +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=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham 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 1ED2320572 for ; Tue, 22 Jan 2019 07:34:16 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 5C7622674B1; Tue, 22 Jan 2019 08:33:59 +0100 (CET) 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 26C6B2674CB; Tue, 22 Jan 2019 08:33:57 +0100 (CET) Received: from hqemgate14.nvidia.com (hqemgate14.nvidia.com [216.228.121.143]) by alsa0.perex.cz (Postfix) with ESMTP id B3AE52667E7 for ; Tue, 22 Jan 2019 08:33:53 +0100 (CET) Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqemgate14.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Mon, 21 Jan 2019 23:33:34 -0800 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Mon, 21 Jan 2019 23:33:51 -0800 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Mon, 21 Jan 2019 23:33:51 -0800 Received: from HQMAIL102.nvidia.com (172.18.146.10) by HQMAIL101.nvidia.com (172.20.187.10) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Tue, 22 Jan 2019 07:33:51 +0000 Received: from HQMAIL106.nvidia.com (172.18.146.12) by HQMAIL102.nvidia.com (172.18.146.10) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Tue, 22 Jan 2019 07:33:51 +0000 Received: from hqnvemgw01.nvidia.com (172.20.150.20) by HQMAIL106.nvidia.com (172.18.146.12) with Microsoft SMTP Server (TLS) id 15.0.1395.4 via Frontend Transport; Tue, 22 Jan 2019 07:33:51 +0000 Received: from linux.nvidia.com (Not Verified[10.24.34.185]) by hqnvemgw01.nvidia.com with Trustwave SEG (v7, 5, 8, 10121) id ; Mon, 21 Jan 2019 23:33:51 -0800 From: Sameer Pujar To: , , Date: Tue, 22 Jan 2019 13:03:20 +0530 Message-ID: <1548142401-22841-6-git-send-email-spujar@nvidia.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1548142401-22841-1-git-send-email-spujar@nvidia.com> References: <1548142401-22841-1-git-send-email-spujar@nvidia.com> MIME-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1548142414; bh=PfiEViNkdiVkEKR6mqUB6DzsXhmVmxe25sUgSJj/nNg=; h=X-PGP-Universal:From:To:CC:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:MIME-Version:Content-Type; b=QFngWUjAWfGSpLhPr84uvRpBnxOdBb4vaG9qF4x9rE3k8duAjbUs1F0TpIKSXBSj9 BU9NO13qQzyAN7GciMVnjF3q6PCDcsdHlg8DhqEQzJr4oQGAXln5Cz7nd93HGYqS16 M0YRoXpMF8PGZ72riJNOaJEdC5EDvHu9KRI8vBFD4y9BlQHkatFkpNyCkW/e2eBxxR F0RH841F9Mkpc/LjbELYRd23Yp/n51VYuiXgPYfnX9M2qOshyb1P5899cKhXuvpzYt ZB3Ed7Cs59yPQscZBQ+pm2Sv6BMyQ2bI64rTMhPOmnzphI0mQGsjXasWDflXGWtr0L 4DumxfJsRgA8w== Cc: alsa-devel@alsa-project.org, Sameer Pujar Subject: [alsa-devel] [PATCH v2 5/6] ALSA: hda/tegra: implement runtime suspend/resume 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP This patch moves clock enable/disable from system resume/suspend to runtime resume/suspend respectively. Along with this hda controller chip init or stop is also moved. System resume/suspend can invoke runtime callbacks and do necessary setup. chip->running can be used to check for probe completion and device access during runtime_resume or runtime_suspend can be avoided if probe is not yet finished. This helps to avoid kernel panic during boot where runtime PM callbacks can happen from system PM. Signed-off-by: Sameer Pujar Reviewed-by: Ravindra Lokhande Reviewed-by: Mohan Kumar D --- sound/pci/hda/hda_tegra.c | 49 +++++++++++++++++++++++++++++++---------------- 1 file changed, 33 insertions(+), 16 deletions(-) diff --git a/sound/pci/hda/hda_tegra.c b/sound/pci/hda/hda_tegra.c index f068b1e..a7fd4c6 100644 --- a/sound/pci/hda/hda_tegra.c +++ b/sound/pci/hda/hda_tegra.c @@ -233,32 +233,24 @@ static void hda_tegra_disable_clocks(struct hda_tegra *data) static int hda_tegra_suspend(struct device *dev) { struct snd_card *card = dev_get_drvdata(dev); - struct azx *chip = card->private_data; - struct hda_tegra *hda = container_of(chip, struct hda_tegra, chip); - struct hdac_bus *bus = azx_bus(chip); + int rc; + rc = pm_runtime_force_suspend(dev); + if (rc < 0) + return rc; snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); - azx_stop_chip(chip); - synchronize_irq(bus->irq); - azx_enter_link_reset(chip); - hda_tegra_disable_clocks(hda); - return 0; } static int hda_tegra_resume(struct device *dev) { struct snd_card *card = dev_get_drvdata(dev); - struct azx *chip = card->private_data; - struct hda_tegra *hda = container_of(chip, struct hda_tegra, chip); - - hda_tegra_enable_clocks(hda); - - hda_tegra_init(hda); - - azx_init_chip(chip, 1); + int rc; + rc = pm_runtime_force_resume(dev); + if (rc < 0) + return rc; snd_power_change_state(card, SNDRV_CTL_POWER_D0); return 0; @@ -268,11 +260,36 @@ static int hda_tegra_resume(struct device *dev) #ifdef CONFIG_PM static int hda_tegra_runtime_suspend(struct device *dev) { + struct snd_card *card = dev_get_drvdata(dev); + struct azx *chip = card->private_data; + struct hda_tegra *hda = container_of(chip, struct hda_tegra, chip); + struct hdac_bus *bus = azx_bus(chip); + + if (chip && chip->running) { + azx_stop_chip(chip); + synchronize_irq(bus->irq); + azx_enter_link_reset(chip); + } + hda_tegra_disable_clocks(hda); + return 0; } static int hda_tegra_runtime_resume(struct device *dev) { + struct snd_card *card = dev_get_drvdata(dev); + struct azx *chip = card->private_data; + struct hda_tegra *hda = container_of(chip, struct hda_tegra, chip); + int rc; + + rc = hda_tegra_enable_clocks(hda); + if (rc != 0) + return rc; + if (chip && chip->running) { + hda_tegra_init(hda); + azx_init_chip(chip, 1); + } + return 0; } #endif /* CONFIG_PM */ From patchwork Tue Jan 22 07:33:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sameer Pujar X-Patchwork-Id: 10775019 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 919B2913 for ; Tue, 22 Jan 2019 07:34:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 79AB52A937 for ; Tue, 22 Jan 2019 07:34:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6BFEF2A93A; Tue, 22 Jan 2019 07:34:23 +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=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham 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 A94B12A937 for ; Tue, 22 Jan 2019 07:34:22 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id AA1F12674B2; Tue, 22 Jan 2019 08:34:04 +0100 (CET) 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 20F3926748F; Tue, 22 Jan 2019 08:34:03 +0100 (CET) Received: from hqemgate16.nvidia.com (hqemgate16.nvidia.com [216.228.121.65]) by alsa0.perex.cz (Postfix) with ESMTP id 549942674CB for ; Tue, 22 Jan 2019 08:33:56 +0100 (CET) Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqemgate16.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Mon, 21 Jan 2019 23:33:21 -0800 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Mon, 21 Jan 2019 23:33:56 -0800 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Mon, 21 Jan 2019 23:33:56 -0800 Received: from HQMAIL109.nvidia.com (172.20.187.15) by HQMAIL104.nvidia.com (172.18.146.11) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Tue, 22 Jan 2019 07:33:55 +0000 Received: from HQMAIL104.nvidia.com (172.18.146.11) by HQMAIL109.nvidia.com (172.20.187.15) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Tue, 22 Jan 2019 07:33:55 +0000 Received: from hqnvemgw01.nvidia.com (172.20.150.20) by HQMAIL104.nvidia.com (172.18.146.11) with Microsoft SMTP Server (TLS) id 15.0.1395.4 via Frontend Transport; Tue, 22 Jan 2019 07:33:55 +0000 Received: from linux.nvidia.com (Not Verified[10.24.34.185]) by hqnvemgw01.nvidia.com with Trustwave SEG (v7, 5, 8, 10121) id ; Mon, 21 Jan 2019 23:33:55 -0800 From: Sameer Pujar To: , , Date: Tue, 22 Jan 2019 13:03:21 +0530 Message-ID: <1548142401-22841-7-git-send-email-spujar@nvidia.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1548142401-22841-1-git-send-email-spujar@nvidia.com> References: <1548142401-22841-1-git-send-email-spujar@nvidia.com> MIME-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1548142402; bh=3dM/ZSb4AgbiIwpN4cpnsZ9ftfOs7xOWos5B8cQdY7c=; h=X-PGP-Universal:From:To:CC:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:MIME-Version:Content-Type; b=dUSbyyTYALNHwkoLi8w5XuUoGJ+5kwBhRVIwC6bUawIfS9ajpAwx6Nd6S6jZPayPZ pK5xYFmZuOixsl09dbqoZPe0J2dv5ypiCyvp5UsyWW9iTICx6sp5CxhgOx0DdoWGeT oWX93f4KH0pesvlxLAPnvIIbV6HkUxfJCsBSz57M0t6BNd08VEgtaNSTSYneg1aqc5 Azmwb1tONSvKy4apY217Vy8cRkD0xbMLohwBnzE5jx8y3QVRJbkjJDrTZqJgDrESW4 otS4Aa1oPdfduvg5hXBFLU26fjPa6u6MkDgDBV4iC99aKp73uhwY4KBhDTBpa2PyK/ TfpFatCMk2OSQ== Cc: alsa-devel@alsa-project.org, Sameer Pujar Subject: [alsa-devel] [PATCH v2 6/6] ALSA: hda/tegra: add driver flag for runtime PM 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP AZX_DCAPS_PM_RUNTIME flag is added to indicate support for runtime PM. azx_has_pm_runtime() is used to check if above is enabled and thus forbid runtime PM calls if needed. Signed-off-by: Sameer Pujar Reviewed-by: Ravindra Lokhande Reviewed-by: Mohan Kumar D --- sound/pci/hda/hda_tegra.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sound/pci/hda/hda_tegra.c b/sound/pci/hda/hda_tegra.c index a7fd4c6..c8d18dc 100644 --- a/sound/pci/hda/hda_tegra.c +++ b/sound/pci/hda/hda_tegra.c @@ -520,7 +520,8 @@ MODULE_DEVICE_TABLE(of, hda_tegra_match); static int hda_tegra_probe(struct platform_device *pdev) { - const unsigned int driver_flags = AZX_DCAPS_CORBRP_SELF_CLEAR; + const unsigned int driver_flags = AZX_DCAPS_CORBRP_SELF_CLEAR | + AZX_DCAPS_PM_RUNTIME; struct snd_card *card; struct azx *chip; struct hda_tegra *hda;