From patchwork Tue Jan 22 07:33:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sameer Pujar X-Patchwork-Id: 10775007 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 4C2BF91E for ; Tue, 22 Jan 2019 07:33:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 359902A937 for ; Tue, 22 Jan 2019 07:33:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 28A742A93E; Tue, 22 Jan 2019 07:33:39 +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 C59D32A937 for ; Tue, 22 Jan 2019 07:33:37 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id C9F6B267487; Tue, 22 Jan 2019 08:33:35 +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 9958126748F; Tue, 22 Jan 2019 08:33:33 +0100 (CET) Received: from hqemgate15.nvidia.com (hqemgate15.nvidia.com [216.228.121.64]) by alsa0.perex.cz (Postfix) with ESMTP id 6419F2667E7 for ; Tue, 22 Jan 2019 08:33:30 +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:05 -0800 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Mon, 21 Jan 2019 23:33:29 -0800 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Mon, 21 Jan 2019 23:33:29 -0800 Received: from HQMAIL102.nvidia.com (172.18.146.10) by HQMAIL104.nvidia.com (172.18.146.11) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Tue, 22 Jan 2019 07:33:29 +0000 Received: from hqnvemgw01.nvidia.com (172.20.150.20) by HQMAIL102.nvidia.com (172.18.146.10) with Microsoft SMTP Server (TLS) id 15.0.1395.4 via Frontend Transport; Tue, 22 Jan 2019 07:33:29 +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:28 -0800 From: Sameer Pujar To: , , Date: Tue, 22 Jan 2019 13:03:15 +0530 Message-ID: <1548142401-22841-1-git-send-email-spujar@nvidia.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1548142385; bh=FfXeVC3oe3Bc51SBluwlOWWlDM7BDtzyHI0qv0ij8ss=; h=X-PGP-Universal:From:To:CC:Subject:Date:Message-ID:X-Mailer: MIME-Version:Content-Type; b=r29d1SbR0YPKH+wvYKBpANOozlQ7O4i1u3D0Vb0DDtFA+cDl1hnBwHEhNbQrwt/H/ aXpuWxmUzACzedQM8IlMJJIsyJSEBjVa3/I7dds9OeZmPRyVgWCJ7QmZOdUf1cQTFg chxVZSxPfEwf5LQWLCHU3EJHaXIS1qBY6R2ng20suIHQxg2MqekHDgzBLExaRvXwej YnJBFPyTA5q0TunWQf5C7KKoQfmSbhaG3lff6Ws4PU50Hl1G65NehZxAbXEskfTWag QYRwwP4q7ydW0IwGrF7wOEXcSlKSULkF5lp0V3HKWr+HtB5MtFbelwtlSV3BJvK8WH S/2z7ZLjG8/3w== Cc: alsa-devel@alsa-project.org, Sameer Pujar Subject: [alsa-devel] [PATCH v2 0/6] Runtime PM support (hda/tegra) 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 Background ========== The device power management operations can be controlled with the help of runtime power management (runtime PM) framework. In this case hda driver can register runtime PM callbacks with the power management core (PM core). Idea is to put the device in low power mode, when it is not getting used. The clocks and power domains can be turned off when no use case is running on the device. Current patch series adds necessary support to manage hda device at runtime. Change log ========== v1: ------ Patch-1: "ALSA: hda/tegra: runtime power management support" * runtime PM enable/disable added in device probe/remove * runtime PM calls are forbidden if AZX_DCAPS_PM_RUNTIME is not enabled in driver flags * worker thread uses pm_runtime_get_sync to invoke ->runtime_resume and pm_runtime_put to invoke ->runtime_suspend. The callbacks are added in subsequent patches Patch-2: "ALSA: hda/tegra: get clock handles early in probe" * Clock handles required for hda are acquired early in the probe. This is done to make use of runtime PM framework to enable/disable clocks in the callbacks. Patch-3: "ALSA: hda/tegra: add runtime PM callbacks" * adds runtime PM callbacks for ->runtime_suspend(), ->runtime_resume() * only skeleton for the callbacks is added, implementation is done in the subsequent patches Patch-4: "ALSA: hda/tegra: remove redundant clock enable API" * As worked thread is calling pm_runtime_get_sync() now, no need to enable the clock explicitly. This can be managed from callback. * Idea is to have clock enable and disable functionalities in runtime PM callbacks and the driver can make use of the above. Any device access should be preceded by ->runtime_resume() call. Patch-5: "ALSA: hda/tegra: implement runtime suspend/resume" * clock enable and controller initialization is moved to ->runtime_reesume() and the reverse is done during ->runtime_suspend() * Also during system wide power transitions, pm_runtime_force_resume() is invoked in system resume() and similarly for suspend case. Patch-6: "ALSA: hda/tegra: fix kernel panic" * kernel panic is happening befoe controller init is done * added a flag "probed" to indicate the completion of device init * this flag is checked before doing any device access. Patch-7: "ALSA: hda/tegra: add driver flag for runtime PM" * driver flag AZX_DCAPS_PM_RUNTIME is added if CONFIG_PM is enabled. * otherwise runtime PM calls will be forbidden and act as dummy calls v1-->v2 ------- Patch-1: "ALSA: hda/tegra: runtime power management support" * no change Patch-2: "ALSA: hda/tegra: get clock handles early in probe" * no change Patch-3: "ALSA: hda/tegra: add runtime PM callbacks" * no change Patch-4: "ALSA: hda/tegra: remove redundant clock enable API" * no change Patch-5: "ALSA: hda/tegra: implement runtime suspend/resume" * Patch-6(v1) commit is melded into this commit * instead of new flag "probed", chip->running status is used to know the completion of probe Patch-6: "ALSA: hda/tegra: add driver flag for runtime PM" * This commit is similar to Patch-7(v1) * AZX_DCAPS_PM_RUNTIME is unconditionally added and CONFIG_PM under which above flag was added is removed ========= Sameer Pujar (6): ALSA: hda/tegra: runtime power management support ALSA: hda/tegra: get clock handles early in probe ALSA: hda/tegra: add runtime PM callbacks ALSA: hda/tegra: remove redundant clock enable API ALSA: hda/tegra: implement runtime suspend/resume ALSA: hda/tegra: add driver flag for runtime PM sound/pci/hda/hda_tegra.c | 120 +++++++++++++++++++++++++++++++++------------- 1 file changed, 88 insertions(+), 32 deletions(-)