From patchwork Mon Mar 26 08:56:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akshu Agrawal X-Patchwork-Id: 10307473 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 943FB600F6 for ; Mon, 26 Mar 2018 09:12:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8592028FD4 for ; Mon, 26 Mar 2018 09:12:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 79CEF28FEE; Mon, 26 Mar 2018 09:12:35 +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.8 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, RCVD_IN_DNSWL_NONE, 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 023FF28FE1 for ; Mon, 26 Mar 2018 09:12:33 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id A28F4266E4B; Mon, 26 Mar 2018 11:12:31 +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 BAC03266F93; Mon, 26 Mar 2018 11:12:28 +0200 (CEST) Received: from NAM03-BY2-obe.outbound.protection.outlook.com (mail-by2nam03on0058.outbound.protection.outlook.com [104.47.42.58]) by alsa0.perex.cz (Postfix) with ESMTP id 46A37266A73 for ; Mon, 26 Mar 2018 11:12:22 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=MfB3Pb9EqTZSmQ8p+4pg3vyoVMccFTG3tJSx4oMOKfY=; b=jD6Il1ycHe4FHxX3ePI2tJ4FxwGXdyekxHa4h7i7B6dqXTyPQwUsoLqHTfHE/be4jiGF6yuAPlC3Tej3zxN3sXuqvKHk5NhvvW1AYSzrxK/vorBzbSa2wp/JAlWzTHdOt4vb+jw/r2rx/Zl7f+U7a5vrSmSFcFVkSPQ66CDn+kc= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Akshu.Agrawal@amd.com; Received: from akshu-HP-EliteBook-745-G2.mshome.net (202.56.249.162) by DM5PR1201MB0188.namprd12.prod.outlook.com (2603:10b6:4:56::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.609.10; Mon, 26 Mar 2018 09:12:18 +0000 From: Akshu Agrawal To: broonie@kernel.org, alsa-devel@alsa-project.org Date: Mon, 26 Mar 2018 14:26:00 +0530 Message-Id: <1522054560-31088-1-git-send-email-akshu.agrawal@amd.com> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 X-Originating-IP: [202.56.249.162] X-ClientProxiedBy: MA1PR01CA0088.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00::28) To DM5PR1201MB0188.namprd12.prod.outlook.com (2603:10b6:4:56::12) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 35aeba5f-b691-452f-0766-08d592f9adca X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:DM5PR1201MB0188; X-Microsoft-Exchange-Diagnostics: 1; DM5PR1201MB0188; 3:Toq6xk3joWb8q8Z52XOHpwl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rYxVKOpYrFkn9jCycRLd/nLB/WJCE1M3s2GBBG14ioP+j6fR9cxanuZIj8V44gKhYdnXkTr5Fmgi8ZquR9hVXxP6EZWRcQREbNhRaCrxp7G9ezb7+TaCgOVHLalmOCRdt0bzMdwuwRbVnPt4c8XN2ieqq0eoqYjl8LAF+HLBr+9bMxToZaWdIBc4qtU+cYF+b+U3yKYAs49dpjIS81T8yiUvXQHK/VW67Imbdt6uuZX3LLW/ly5PU+COhfVzX93uKmh2zJV0ZCPSH+nw7GZTfrs8pSQDvIbkQ1T6jtt5kZ/6Z2CgafSqrjaMJcD6V/n; 4:xUAXWveuGsiW+zn7jd4/wTJXHOS4WFrxVK9BzWAz3dnD0PTdG5qVHE4dn8d1f2kyMTa8/RBAcxXtWysIToKXH94jIdDiAuIsGTGvHpcopvtH59fUOEfo4/kcNSTZEBlwCz8fg2KyND4JrKb0xyFS1A3rjFooXEMXo9n3n0qMk/VdOXgBaMvXqFBjrsIZPIIrffzA6jEnLPwCvAbLp6gQW56KSQdZlH21Exqc4LzX+d6J98xs3WmPWPA7XpnpOQ8omFj3KJyqGKDeAc9snHPinBYmd9SB1o1GDjQrVgLj19uMstzKjfTxYvw1LopYaipD X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3231221)(944501327)(52105095)(93006095)(93001095)(3002001)(10201501046)(6055026)(6041310)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123558120)(20161123564045)(6072148)(201708071742011); SRVR:DM5PR1201MB0188; BCL:0; PCL:0; RULEID:; SRVR:DM5PR1201MB0188; X-Forefront-PRVS: 06237E4555 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(346002)(396003)(39860400002)(366004)(39380400002)(376002)(199004)(189003)(105586002)(53936002)(6486002)(305945005)(7736002)(106356001)(69596002)(25786009)(59450400001)(52116002)(51416003)(5660300001)(72206003)(6512007)(4326008)(97736004)(6666003)(478600001)(16586007)(68736007)(47776003)(3846002)(6506007)(386003)(50226002)(81166006)(186003)(8676002)(66066001)(16526019)(6116002)(81156014)(26005)(8936002)(2906002)(316002)(39060400002)(53416004)(36756003)(2616005)(86362001)(956004)(50466002)(48376002); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR1201MB0188; H:akshu-HP-EliteBook-745-G2.mshome.net; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM5PR1201MB0188; 23:u3m+nX3f4i2H32N6zBQ7dAmLWI2I37HZaX7F3/5?= =?us-ascii?Q?+zZsItM7ZYv37LfPR11jQQJpPEGFz5NQZ2BI4F4Bqu7xxvQ+I/BNn0IGVwne?= =?us-ascii?Q?4m6RinN1SeZFTsRf7YYghpls7a4lSG2tw24dt0ClFU0O/JipEIXXJzKPe3Ob?= =?us-ascii?Q?5ofNKZYBZd6AxAfzZhTAKXDxgFtnfHI1OAmwhqygU2YcoFgqgFslg6gxzQka?= =?us-ascii?Q?N9AON04pPxczrxS+ZS0VPdOzwUlK9rRDtPxJveQQA62sCgOnaicoKjr1Z4Qn?= =?us-ascii?Q?kltPWHAgAjvQUE6G3ef9k9MF3J1ISzkuhgjuAtMmHbviyFqfKkCYwlHcfwaw?= =?us-ascii?Q?QpYUL/E8Gz+kBz5DIN1Fw3T8u+bznJY7bYcH+nwktHi7xijAOqda34kT9Jmb?= =?us-ascii?Q?roUJ6EZACMw9+nesbouTNjeLB4YHvb39hUeQpzEcU6nG1oES/JTTal4e7Z6w?= =?us-ascii?Q?Vy8x7jllMwncCNOI4jjOvNeYvIvTQnJGWjOATLDpQj6dErPQvhEcTDzbmgp1?= =?us-ascii?Q?YXGShhJl7Ba8CwGFShOc0aXZVydYPWTOdTY3Jwox8u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LEijbcrXcftX2UOV66F1K60WVAXyMXPpvnHM1uBrmumq468wciD3757HtCptJFdlCDhKOXZoare1va60vimLaW1kv1aiF8X3GvzeGOW/XQ9nYHJEABlndDHDT+QbKY3mFAdicGaem5L+9xX7dZH8bvQeQMygM/pigsgOZ35YMHJGEVjQCCJgY4hunp++2y+mQxV5EOyZJaxD05DE99WysIF2ZHv5c51+4g7LMSyN9NSy9Zb19G0HsK X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Mar 2018 09:12:18.0659 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 35aeba5f-b691-452f-0766-08d592f9adca X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR1201MB0188 Cc: tiwai@suse.de, Alexander.Deucher@amd.com, lgirdwood@gmail.com, djkurtz@chromium.org, akshu.agrawal@amd.com Subject: [alsa-devel] [PATCH v4] ASoC: AMD: Enable/Disable auxiliary clock via common clock framework 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 enables/disables and sets auxiliary clock at 25Mhz. It uses common clock framework for proper ref counting. This approach will save power in comparison to keeping it always On in firmware. V2: Correcting the pin to OSCOUT1 from OSCOUT2 V3: Fix error/warnings from kbuild test V4: Fix build errors for platform which do not support CONFIG_COMMON_CLK TEST= aplay -vv check register to see clock enabled kill aplay check register to see clock disabled Signed-off-by: Akshu Agrawal Acked-by: Alex Deucher --- sound/soc/amd/acp-da7219-max98357a.c | 144 ++++++++++++++++++++++++++++++++++- 1 file changed, 142 insertions(+), 2 deletions(-) diff --git a/sound/soc/amd/acp-da7219-max98357a.c b/sound/soc/amd/acp-da7219-max98357a.c index 99c6b5c..3c77803 100644 --- a/sound/soc/amd/acp-da7219-max98357a.c +++ b/sound/soc/amd/acp-da7219-max98357a.c @@ -30,10 +30,13 @@ #include #include #include +#include +#include #include #include #include #include +#include #include "../codecs/da7219.h" #include "../codecs/da7219-aad.h" @@ -41,6 +44,20 @@ #define CZ_PLAT_CLK 24000000 #define MCLK_RATE 24576000 #define DUAL_CHANNEL 2 +#define CLKDRVSTR2 0x28 +#define MISCCLKCNTL1 0x40 +#define OSCCLKENB 2 +#define OSCOUT1CLK25MHZ 16 + +struct cz_clock { + const char* acp_clks_name; +#ifdef CONFIG_COMMON_CLK + struct clk_hw acp_clks_hw; +#endif + struct clk_lookup *acp_clks_lookup; + struct clk *acp_clks; + void __iomem *res_base; +}; static struct snd_soc_jack cz_jack; struct clk *da7219_dai_clk; @@ -91,6 +108,8 @@ static int cz_da7219_hw_params(struct snd_pcm_substream *substream, { int ret = 0; struct snd_soc_pcm_runtime *rtd = substream->private_data; + struct snd_soc_card *card = rtd->card; + struct clk *acpd7219_clk; ret = clk_prepare_enable(da7219_dai_clk); if (ret < 0) { @@ -98,13 +117,27 @@ static int cz_da7219_hw_params(struct snd_pcm_substream *substream, return ret; } + acpd7219_clk = clk_get(card->dev, "acpd7219-clks"); + ret = clk_prepare_enable(acpd7219_clk); + if (ret < 0) { + dev_err(rtd->dev, "can't enable oscillator clock %d\n", ret); + return ret; + } + return ret; } static int cz_da7219_hw_free(struct snd_pcm_substream *substream) { + struct snd_soc_pcm_runtime *rtd = substream->private_data; + struct snd_soc_card *card = rtd->card; + struct clk *acpd7219_clk; + clk_disable_unprepare(da7219_dai_clk); + acpd7219_clk = clk_get(card->dev, "acpd7219-clks"); + clk_disable_unprepare(acpd7219_clk); + return 0; } @@ -237,9 +270,113 @@ static int cz_fe_startup(struct snd_pcm_substream *substream) .num_controls = ARRAY_SIZE(cz_mc_controls), }; +#ifdef CONFIG_COMMON_CLK +static int acpd7219_clks_prepare(struct clk_hw *hw) +{ + u32 reg_val; + struct cz_clock *cz_clock_obj = + container_of(hw, struct cz_clock, acp_clks_hw); + void __iomem *base = cz_clock_obj->res_base; + + reg_val = readl(base + MISCCLKCNTL1); + reg_val &= ~(0x1 << OSCCLKENB); + writel(reg_val, base + MISCCLKCNTL1); + reg_val = readl(base + CLKDRVSTR2); + reg_val |= (0x1 << OSCOUT1CLK25MHZ); + writel(reg_val, base + CLKDRVSTR2); + + return 0; +} + +static void acpd7219_clks_unprepare(struct clk_hw *hw) +{ + u32 reg_val; + struct cz_clock *cz_clock_obj = + container_of(hw, struct cz_clock, acp_clks_hw); + void __iomem *base = cz_clock_obj->res_base; + + reg_val = readl(base + MISCCLKCNTL1); + reg_val |= (0x1 << OSCCLKENB); + writel(reg_val, base + MISCCLKCNTL1); +} + +static int acpd7219_clks_is_enabled(struct clk_hw *hw) +{ + u32 reg_val; + struct cz_clock *cz_clock_obj = + container_of(hw, struct cz_clock, acp_clks_hw); + void __iomem *base = cz_clock_obj->res_base; + + reg_val = readl(base + MISCCLKCNTL1); + + return !(reg_val & OSCCLKENB); +} + +const struct clk_ops acpd7219_clks_ops = { + .prepare = acpd7219_clks_prepare, + .unprepare = acpd7219_clks_unprepare, + .is_enabled = acpd7219_clks_is_enabled, +}; + +static int register_acpd7219_clocks(struct platform_device *pdev) +{ + struct clk_init_data init = {}; + struct clk *acp_clks; + struct clk_lookup *acp_clks_lookup; + struct cz_clock *cz_clock_obj; + struct resource *res; + struct device dev = pdev->dev; + + cz_clock_obj = kzalloc(sizeof(struct cz_clock), GFP_KERNEL); + if (!cz_clock_obj) + return -ENOMEM; + + cz_clock_obj->acp_clks_name = "acpd7219-clks"; + + init.parent_names = NULL; + init.num_parents = 0; + init.name = cz_clock_obj->acp_clks_name; + init.ops = &acpd7219_clks_ops; + cz_clock_obj->acp_clks_hw.init = &init; + + acp_clks = devm_clk_register(&dev, &cz_clock_obj->acp_clks_hw); + if (IS_ERR(acp_clks)) + { + dev_err(&dev, "Failed to register DAI clocks: %ld\n", + PTR_ERR(acp_clks)); + return -EINVAL; + } + cz_clock_obj->acp_clks = acp_clks; + + acp_clks_lookup = clkdev_create(acp_clks, cz_clock_obj->acp_clks_name, + "%s", dev_name(&dev)); + if (!acp_clks_lookup) + dev_warn(&dev, "Failed to create DAI clkdev"); + else + cz_clock_obj->acp_clks_lookup = acp_clks_lookup; + + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (!res) { + dev_err(&pdev->dev, "Failed to get misc io resource.\n"); + return -EINVAL; + } + cz_clock_obj->res_base = devm_ioremap_nocache(&pdev->dev, res->start, + resource_size(res)); + if (!cz_clock_obj->res_base) + return -ENOMEM; + + return 0; +} +#else +static int register_acpd7219_clocks(struct platform_device *pdev) +{ + return 0; +} +#endif /* CONFIG_COMMON_CLK */ + static int cz_probe(struct platform_device *pdev) { - int ret; + int ret = 0; struct snd_soc_card *card; card = &cz_card; @@ -252,7 +389,10 @@ static int cz_probe(struct platform_device *pdev) cz_card.name, ret); return ret; } - return 0; + + ret = register_acpd7219_clocks(pdev); + + return ret; } static const struct acpi_device_id cz_audio_acpi_match[] = {