From patchwork Mon Mar 19 05:37:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akshu Agrawal X-Patchwork-Id: 10291669 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 3F574602C2 for ; Mon, 19 Mar 2018 05:53:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2C8BF29121 for ; Mon, 19 Mar 2018 05:53:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 20DEB29125; Mon, 19 Mar 2018 05:53: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=-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 21B0329121 for ; Mon, 19 Mar 2018 05:53:55 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 2BB6526739D; Mon, 19 Mar 2018 06:53:41 +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 26637267332; Mon, 19 Mar 2018 06:53:33 +0100 (CET) Received: from NAM01-BY2-obe.outbound.protection.outlook.com (mail-by2nam01on0064.outbound.protection.outlook.com [104.47.34.64]) by alsa0.perex.cz (Postfix) with ESMTP id 9E193267294 for ; Mon, 19 Mar 2018 06:53:30 +0100 (CET) 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=ZnGuR01ejeCH4tevCEjHwxlf3HfPcBOTPofzY85T+zA=; b=0MccmQgxX+J0xIxc1epGhb4yr0tspXg1OdK+Ug4vao8ecVTsbeJMGQWwGz399pr3My+ySKOGTPpvh5+E4i07zvNZ7zvQm42m2FQDxLZMfW/ewsEaja8k1r4dF6InrPhXdpMIWwxUNg3tRWl3UdsAQ2qZUcL5Upnw3vmnPsfQDUM= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Akshu.Agrawal@amd.com; Received: from akshu-HP-EliteBook-745-G2.amd.com (202.56.249.162) by DM5PR1201MB0185.namprd12.prod.outlook.com (2603:10b6:4:56::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.588.14; Mon, 19 Mar 2018 05:53:26 +0000 From: Akshu Agrawal To: broonie@kernel.org, alsa-devel@alsa-project.org Date: Mon, 19 Mar 2018 11:07:43 +0530 Message-Id: <1521437863-12389-3-git-send-email-akshu.agrawal@amd.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1521437863-12389-1-git-send-email-akshu.agrawal@amd.com> References: <1521437863-12389-1-git-send-email-akshu.agrawal@amd.com> MIME-Version: 1.0 X-Originating-IP: [202.56.249.162] X-ClientProxiedBy: MAXPR0101CA0031.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:d::17) To DM5PR1201MB0185.namprd12.prod.outlook.com (2603:10b6:4:56::9) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 6f2d53b4-ce41-46d2-c80e-08d58d5dbd47 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:DM5PR1201MB0185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YKJAg9Pn5LgHCYdGiZoGhGXEHe9Qu6aphFhbAdK417q8oe+ip5gVC0A2DtGp1zQEmv8XTOhZ93DCNczElU3GTmZgzRxCmgrTSRjUD9xLW3VEt5ybfLYOlMmO+aAmC1SicSetfdLH1XiF7NQp+6AbOD4eXQCUacgYhE0qWask+3BIBpueISEN55gkUJvNsmLe8kw2vJS0M/ZNgELdpgphDfXPFkh/NhsppdksHV8M2jqHNNirkMN6ke4DNAmH8Fth7kgtEj7/EU78lB4ljvnaJcnMBVBhlvs0IC8TG2DofIZmv3sgvlXnbgC07i10aKEq2So8m2cdM8gvN6BQq7XB5O1FLcaO/zjlfalpncUjuW464aYIey2eZNcwM34AnkomcpdZwyCcEtNW1A+b17NQa; 4:VYo3m5GgI1l2uq7+6oMf2jD27AdZCu4n4jpMxqa3lWI5w2J4wahc8Zh50KXLDj6jwVq7inDyiqVHEb+FGbBAUvYNz1CMRPYa/wkehMsitIO2KGQE8lAP+DcLKZJ74MFUFp4BkEB0QEno9TfejQeiLnok7dAaMV5OMQqbcz39fEW+Hk77iGVm3QGjM4v8F/BFbJX7yC084oSYFiRW+ypgtR+1gN9/EP45UruwkzdAvXi1UODxpdbQCLHxiMQz1a8UN9GrkkMHRu5F0dPNs3IGcupTxcPnHpcGEzsVyYgEWcQSKzrsn8Y+h+g/9g9CX6iH 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)(944501300)(52105095)(3002001)(93006095)(93001095)(10201501046)(6055026)(6041310)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123562045)(20161123558120)(6072148)(201708071742011); SRVR:DM5PR1201MB0185; BCL:0; PCL:0; RULEID:; SRVR:DM5PR1201MB0185; X-Forefront-PRVS: 06167FAD59 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(366004)(39860400002)(376002)(39380400002)(346002)(396003)(189003)(199004)(66066001)(47776003)(53416004)(2950100002)(8676002)(81156014)(6666003)(81166006)(68736007)(97736004)(53936002)(106356001)(48376002)(50466002)(16526019)(26005)(316002)(305945005)(16586007)(39060400002)(4326008)(478600001)(5660300001)(186003)(52116002)(7696005)(51416003)(76176011)(36756003)(7736002)(72206003)(59450400001)(386003)(50226002)(6116002)(86362001)(2906002)(25786009)(8936002)(3846002)(6486002)(105586002); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR1201MB0185; H:akshu-HP-EliteBook-745-G2.amd.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A: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; DM5PR1201MB0185; 23:eLZV7z80sShlUV2p3llH5izNWTOC7cgxxCZjG2H?= =?us-ascii?Q?Tv6oV5sTSPdDT5ghPoxUUjuhhkXHxPBQaKkY6gR91EzwdDQzLWoX+qY1KLHF?= =?us-ascii?Q?DpShrrO7fgk1z90P3CGM10IQNrVg878TxbCntxX0j1jo57/sgJQcdct3sHca?= =?us-ascii?Q?GxR+DLpz3TJ6M41rY4B7gEK3McpUWBO4O4VCdVYtctn9PD3zq9K2EoWLKeYx?= =?us-ascii?Q?IjUlGbGzXz0jnkJvbOTwn+Y3nogLfTs9lKfdz2c5tj3n1EQs5pMKscxObufp?= =?us-ascii?Q?o9UFISM5bZ5ogeZcKufgmdIkJdVElv8/AKFfzUQEwdeofC4emgWCQYWxZE+M?= =?us-ascii?Q?isWYsf3dWi2Q9CyvEFuGXMcnykH8ullnkgtHckCfUJQXfUO+U8rBMgOMkrkz?= =?us-ascii?Q?FuuE6Y1XnMa8xfEebme2SMIsXnkrHv0ccKN1Y2k0+RZQavdcieLE5zPlPWqL?= =?us-ascii?Q?pEfn19/sFNJZynLpc/Fnyrd3XYn78yPeBDRTuIKJUqODmO0lcWjIweyaatAu?= =?us-ascii?Q?oEpHEkzh3T1c3dj2rRXb5BaNSp+M6S6ojz6k3teN22ojX1dD9eNQkNks8Gvf?= =?us-ascii?Q?fC+8JUi8XP46hIxPIlpNOzFhRYLAqYb17/OA2z6zWb9GTujrlR0Xhws2bqtX?= =?us-ascii?Q?NOJl80ktKIKdZv95nDjOBPaxJQGDIGmbn21NZ0vx8PnuSziiSmMXQ6ZDiO0O?= =?us-ascii?Q?RhlcruS+3pXJEwy1axsNA4cBGv2FzJDol/7McaLbxup/Lk2+vdR4RJFhJzf5?= =?us-ascii?Q?aG++yq8BrLoMgTaau/wRqVdBaVEprRQAq/hq3EQDNLdnelO657GXUz1dlGzP?= =?us-ascii?Q?WIC/5Zo4bDHpJatlfeTYRCx++emoXPen3wRyogScZADX5kudOHPYRhh9xJY9?= =?us-ascii?Q?BpgLmV+6IlyTo3IyVoTCCFsiCLSg7bmhPLCO/l4g1Ma00vzIYu1uydpNAe+f?= =?us-ascii?Q?Yv0nSW2o3lSOhfYXdp33E75xg3AzvKGoYBP9pQIOHyS/X0uiF//QB2bTQNpT?= =?us-ascii?Q?pmvm9hbCyV3BEE6H7IBLuM6nhHrIptPono1SEnbIB+mrPlOKMZCP9d9Lc6jY?= =?us-ascii?Q?2XmVjR2xPVEmHFLXo8t6b1SBOPc6OHMlFT+ilLjLcMTPKLHwR34lqqfAaHYC?= =?us-ascii?Q?wfHmVnb88Iy8Yk4+pLnQ5FhjPXWva7BEmPuOBsSM4VPb2rnZkIA7B4A=3D?= =?us-ascii?Q?=3D?= X-Microsoft-Antispam-Message-Info: 99+JUudNrOB2fHKROFKNc64RcB4RqpuXLSi6E+bhEWQjBPcNNKD42LtY2k/KsAsaf0m1CpyGN6hOhnMmAebq9fUyMIAJw4kFtQv4rvQshkw1jz/MSdyFgAzfKtMVJ4Oh9qr5csdEmgsryn/7aVNke8ugRsqDzG/SIycu98EXgO0cCLqdyuSvflCftXsvDAOk X-Microsoft-Exchange-Diagnostics: 1; DM5PR1201MB0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6o5zDYyRG2QcgzeZ9rOdQg1BYD6xDceIF8cRTaE3Oa6J5nYDtqkgNHhNECpT99U7ws126NjskS2wX13NaU/ID6wtkuBx48CX83e4dAIt6I6KZ4ubrrF3GcbKIkG5NpNDfuwkGk5/FZDLOKMFyRbna5PCjrRaBm8kA9qNVj0J+IYdO3o X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Mar 2018 05:53:26.6186 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6f2d53b4-ce41-46d2-c80e-08d58d5dbd47 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR1201MB0185 Cc: tiwai@suse.de, lgirdwood@gmail.com, djkurtz@chromium.org, akshu.agrawal@amd.com Subject: [alsa-devel] [PATCH 3/3] 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. TEST= aplay -vv check register to see clock enabled kill aplay check register to see clock disabled Signed-off-by: Akshu Agrawal --- sound/soc/amd/acp-da7219-max98357a.c | 133 ++++++++++++++++++++++++++++++++++- 1 file changed, 131 insertions(+), 2 deletions(-) diff --git a/sound/soc/amd/acp-da7219-max98357a.c b/sound/soc/amd/acp-da7219-max98357a.c index 99c6b5c..e37a622 100644 --- a/sound/soc/amd/acp-da7219-max98357a.c +++ b/sound/soc/amd/acp-da7219-max98357a.c @@ -34,6 +34,7 @@ #include #include #include +#include #include "../codecs/da7219.h" #include "../codecs/da7219-aad.h" @@ -41,6 +42,18 @@ #define CZ_PLAT_CLK 24000000 #define MCLK_RATE 24576000 #define DUAL_CHANNEL 2 +#define CLKDRVSTR2 0x28 +#define MISCCLKCNTL1 0x40 +#define OSCCLKENB 2 +#define OSCOUTCLK25MHZ 19 + +struct cz_clock { + const char* acp_clks_name; + struct clk_hw acp_clks_hw; + 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 +104,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 +113,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 +266,106 @@ static int cz_fe_startup(struct snd_pcm_substream *substream) .num_controls = ARRAY_SIZE(cz_mc_controls), }; +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 << OSCOUTCLK25MHZ); + 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; +} + static int cz_probe(struct platform_device *pdev) { - int ret; + int ret = 0; struct snd_soc_card *card; card = &cz_card; @@ -252,7 +378,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[] = {