From patchwork Mon Mar 19 08:26:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akshu Agrawal X-Patchwork-Id: 10291875 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 460D260386 for ; Mon, 19 Mar 2018 08:42:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 349B829163 for ; Mon, 19 Mar 2018 08:42:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 28E43291C1; Mon, 19 Mar 2018 08:42:46 +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 3E5E229163 for ; Mon, 19 Mar 2018 08:42:45 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 5DFEB2674F6; Mon, 19 Mar 2018 09:42:32 +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 92C752673C4; Mon, 19 Mar 2018 09:42:26 +0100 (CET) Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on0088.outbound.protection.outlook.com [104.47.36.88]) by alsa0.perex.cz (Postfix) with ESMTP id 44BD82672C0 for ; Mon, 19 Mar 2018 09:42:24 +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=f0ZxEQTvb8I9dgI2sMPpGORdD32vJgWfIEELH8Z9LO0=; b=Lo0I1IZUh7iyp7+cY9c2c6336KSbt5hVxBOaxPt6v6m4H26pJm1Ovxda99uUvIZ9VkRg6r2knTUhjdftaeJ8wb3uNcXxFJ+/7FHqbqz3LNFuqAna2cO+hhTJquOJiAZzXNFFhHdCfsbNpOsWRdjxfAz9iOTOWZIVCbOsZ+d0sKI= 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 BN6PR1201MB0177.namprd12.prod.outlook.com (10.174.115.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.588.14; Mon, 19 Mar 2018 08:42:20 +0000 From: Akshu Agrawal To: broonie@kernel.org, alsa-devel@alsa-project.org Date: Mon, 19 Mar 2018 13:56:39 +0530 Message-Id: <1521447999-24120-3-git-send-email-akshu.agrawal@amd.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1521447999-24120-1-git-send-email-akshu.agrawal@amd.com> References: <1521447999-24120-1-git-send-email-akshu.agrawal@amd.com> MIME-Version: 1.0 X-Originating-IP: [202.56.249.162] X-ClientProxiedBy: PN1PR01CA0089.INDPRD01.PROD.OUTLOOK.COM (10.174.144.157) To BN6PR1201MB0177.namprd12.prod.outlook.com (10.174.115.9) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: bdaca662-8c70-4d58-7f5b-08d58d755578 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:BN6PR1201MB0177; X-Microsoft-Exchange-Diagnostics: 1; BN6PR1201MB0177; 3:giv7Qka5t6qeOE7J46FOp6tMA8i2mR370TS5a6fYuIdMAo4SAyHTfyujIaftZiGbkE3EdTkz2O+P6NlWmjLlpklMOTFpT7c/hxPuqRPLQQTOLx3q6xdUt5InlfRO0/Ocamfg2fc0D5KzT+xpRr9mFiQhrCjcnq7/KlFRLf13kTT7poDKSulvLi4hAjcsFeODn84XuclrncQZTN1LN5QWJtei9Z/HcAMoAWNoG6ujC6Y8zK1/s7u0RIsdaKvMUhNG; 25:TOxgC7eCgNOooE3lOju/rz0JpTtZrLLmCzdqOHbFE0uNiWg8nElOgqbMhOtxINaF21NXbDJUlh6TMCLdvNAdHmbxF7hd29yx6Dh9ABeYHRX/hkK1vdrtL3MIKhgM4jNAKeVjq0QldW5sRE6dJsbRZY+Zom+C6dY838To7uK84nyWUO5D7Lol9RNbhdKQV4BVOWfSAbWvnNoxw0BuOHob+zNGVLL3gSjVxfS9LKrWE6kvlMyao87HiezLOO+3AvwbAMXyUiEmncK8uA/ON7hoaWoiTk6fS3jpdT9VeELfDGGSqqyd5TlFSiAOitD3gTWJoBP6aAdUy8PEPEPsvVGkSA==; 31:no3zy9ts/y0OHXrnRq1RuIKvGCKrOpQwhekUtRymeZvaqMEI0xb92OzymFFQ6s+IUXzD6mNHTz0hppusT4KgVBYmvWKbp0x30bkN7368O5jYDWiie5vEqHQ1vdDGfTNDsmcLRJq+d7FNC7hpwO4sumaQ14RRiEcbrDalG2KvlK35IrEVQJFFpCxLzZekJ/Fq32qZpncmfmUDM6aYfVfyvEbflBFjlsqUbEoRY+8j03A= X-MS-TrafficTypeDiagnostic: BN6PR1201MB0177: X-Microsoft-Exchange-Diagnostics: 1; BN6PR1201MB0177; 20:eAsQyi6wtQtY4tDsyjt0H7+ghywN89g4o1+PEw4fZlqN8XlMkosRq11QRGLzGhLbLkCQmeSaFXHYElGF4++qZtA6EBIAMm64J6psi2vHUvu4cLZf8RVNMOKaxzDKwzlRS2TQmcyHKBpLH9tl2BFrU/2gCdsyL2nfZizDPHxQR2pvLzhzG2gfX4BbBdfmzdIhUIXrSzICeRu2BjP+zclS8C0bTSomqJbE7jloC0zDHU+aezrHZDhKGTNOxQGp0Jr/8DU4velPmx+iH9KZt+2D80bSvOfxTUcCW3kP16wSMikzNY6ili/mfxJTuLavFf5CSUdhueHsCfbHQm3gQaGgpJ7vvkZC41YErEEFptb7tVfxt6Rf7UqZD0bqobSFVLLobV8l4NjALKeQKnZfrZfCtmuT7qrUreuuPaSCFym+N32u5przdjoewRpvuYtrA0/zrnM75f6iUJIDQZoZnPvQ/bBsizb8INjthSoDZsC69syxeJYUIg/Qi6XMBDNEehi3; 4:JzavIpPacyTw31QRceG3UNo3rhzqpwHnN/RW/HbPd/U3SDnXCNYmwc9mH4po92c4RSqx2MvocToyrTHB+w0C5IBULF71LDbAjTAlrGgYzIjcWPQqpT9XaueQi3v6JjIRdmPxCVR4DModp5u/I8HOjoWMSUf0LBl0wkCcz0aht/2hHUpzRC3/fPZbsG/LmWuaWpN+1MZdn3CoKjIWfYulLTOosVsclmLkxE+o2J/Ngi0F5U96HDMj8vdVGxcASU3vOOzq1oQPuvGygCxbxG05nijVpyj4KKQ3B91ehu3APXhEKGG7n6UMB4DdfiJsECwH 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)(944501244)(52105095)(3002001)(93006095)(93001095)(10201501046)(6055026)(6041310)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123562045)(20161123558120)(6072148)(201708071742011); SRVR:BN6PR1201MB0177; BCL:0; PCL:0; RULEID:; SRVR:BN6PR1201MB0177; X-Forefront-PRVS: 06167FAD59 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39380400002)(366004)(396003)(39860400002)(346002)(376002)(199004)(189003)(36756003)(2950100002)(66066001)(6666003)(25786009)(47776003)(305945005)(8676002)(6486002)(68736007)(316002)(7736002)(16586007)(50466002)(48376002)(53416004)(39060400002)(97736004)(76176011)(52116002)(86362001)(53936002)(7696005)(4326008)(72206003)(105586002)(478600001)(5660300001)(106356001)(2906002)(26005)(386003)(3846002)(50226002)(81156014)(59450400001)(6116002)(8936002)(186003)(81166006)(51416003)(16526019); DIR:OUT; SFP:1101; SCL:1; SRVR:BN6PR1201MB0177; H:akshu-HP-EliteBook-745-G2.amd.com; 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; BN6PR1201MB0177; 23:PUUxoklok3IJlV8Eq2EkKOFliOVbOfFB+GWHQ58?= =?us-ascii?Q?MR3cD4tEYLrUQIandXtARcHDRzTle3TcaFpr21axLOht/cvjOeRRC9j+5X81?= =?us-ascii?Q?EYo1HYqRvTAKyOKW7XBaX5PjCj9bwQQ4Cy+SYqLpk6h0PnaB3q5UUMcqyrnj?= =?us-ascii?Q?K8/oFmhzfecUiCNJJ3GxrceI2s9n2WAlJNlGkXBWsUJF84e2Htyd4IB6G7K8?= =?us-ascii?Q?I0N17qPWvAfTlfOLU48738sMWxBfwcH8W8gPdL1AzgWaiPDZFrsX+eVMSLtj?= =?us-ascii?Q?jV/d3NIgu1w+JHgiC33mGj27v3XQJ5mT0Amv4MoOFXPZTASlYyHD8qFy3+1x?= =?us-ascii?Q?WWj+zIT26F8vOZJ8haZIAQSDfxPprVuzXZMzitGV0s7Ql5heg1Wwnlk3YD0J?= =?us-ascii?Q?5nNchDwYXJigneSUlntnMwFd2QhwQ40baOyh1gCFn/M0IAwdR2rjZIFqhd6P?= =?us-ascii?Q?GkGdJUNHieTsFaTo83ZAl15WpjssMR/pR/+Abxc+adCbT9vGyZscDjKYC+cC?= =?us-ascii?Q?jEvGrQPFvbtpLqAy45GqQRv54LfN124WqOl/JTPiq29mcMsJnBdej+gwvc+p?= =?us-ascii?Q?6ht388GXeOjpi3HD548CISe2SRTwxcyEdGNqhrLRhQjvExzmwc2Lyj6XxP5e?= =?us-ascii?Q?29lff7lRdcg+Wundd1lw7ipShXo4cE1bJ6bdo0vvU9arWo/JHiqjNWujcqJ5?= =?us-ascii?Q?COa8Z6vRn6NI/rLDpAlyMx0/vtIBI2ra8UcH70XGdyc5c/LzczwJnueN0IWD?= =?us-ascii?Q?EFxXcDhM54W0ugpbXPuZ1HpZIhITvi5GJrjCoYyhAZJb7yCur70H4Q83N/2h?= =?us-ascii?Q?dcHt2G11xDytL0C4dRnMhEf9CP3beWimN3ifO8T5FF++O5tdEuVqeCK7+qvN?= =?us-ascii?Q?GbNUzc+PENZB5P+4gKYPUhAtx8e7kPby+HHl4rY9vSE4YiyXqsp9UnkbpKhQ?= =?us-ascii?Q?UGORiWbsfyfKCKX2WnxqvxOcz0PZaxwIDR+J7CeoJyNWLYxZP220YqcrIORt?= =?us-ascii?Q?pwcwZuuOYmCrIJ2Lw1tCm2eKAJgxi7UwT2f1ZhUWelHN55VTwbviOJdMZMXS?= =?us-ascii?Q?s5njNt17gw/s0dv+L0DBTdSgVydaaoUlnuK+bLlYpaah4KzoSRxdzlEdJIOa?= =?us-ascii?Q?FXmy/3zSXBYVCcgipfBs+BpZPRfoCUIdvuRGp5me1A30IsBxjND3cdQ=3D?= =?us-ascii?Q?=3D?= X-Microsoft-Antispam-Message-Info: b/fisS+uSZEPmm2I3ce/atHqvT/lXyYdda7LekYzA8JHMPtLaon16FSAd2aUQ1hRscDZo5wYRrxyfQWO2kJBlHFQDqWDq+kAdJlVRGhc8S7IokjmWATN140fBSpABLFGUgF8GCyC4vdrs8gLi7/rLrOhfIaY6ylQi2Eo4PfsIjR0VDpCowYEFrADXM4+9TBV X-Microsoft-Exchange-Diagnostics: 1; BN6PR1201MB0177; 6:ab9H7jjfxKLgxLc8DnJhN9Yl89WPpkqg6xOaj8Ce/JcdaFI+4sck3wqLBBFK2rTvQF1wgyJYtW6RtxgbdmqBXLDpZed2+TkFiJTp5P8u3OxvYS1DGqLKxUzYElNBJK+iWJEDYlTsroyDCoAlxCkpGz6WYIK7sGbisanWgIragXGVakxCBD+CMxfU7+X3jwyd8Wi7fv4veaHAa+Y41oDyEubnhuVDz+GoV2vsfF7qgrY+JQvtiX4YCQa76wbeQsRS9IrFHKihBJKfYtOhK7bpTIePVwL01U6yplOxqnMoU2HeLOoqXTp6Puvohi6thfvsaMzvuOumOnGx3m97hRgaasZnaPN71FwEZ6rBYGozQUg=; 5:i/dgPYpbfP5gN+divJzksc3oN8bvo2Ve2f4cqL5XGv5MTsTUORVVJOnZkwaAhACBUmfWZf3iOran5zu+eX29VUl3ImuJo91xvkK3T41T6gMqtHMg25BYf3k2V/SyWHRqoPCdxSupd9ngG/It4bg0nw/Z3scXqiWphNQ8GcNZaiU=; 24:YLJJiKC7shXPltBui7IMoVGTVsMF1Xuq6ID9syAObccVDBx/m7L8XJNBqZeS2fw/cVit2NGBfUFoEop5o0FKCVaEDrvK/2JBu5cz/pguPYI=; 7:W8u0hdiDpTVd4999mtXF/8hdomP7vuN8Zeyo+v0V+VpX/I00iqxpfQ1N3Xehy/tZJNrECDcrCcyuWL4TKz6gk1gN3egyeVHGF9GYgRFx4BItVsH84v68YqK/1RH3qFyqw3lKon+LFjixddmAP984EAJ3grIXb/BbcIyjQmKtOq0fsbqfHhgf6ybrsuKFSMva28PxxALrA43AhNcVmcipz8Wx+lNHBlE971o6gZECi3A0aJ+dI5yrUi9IbYgeW+VW SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BN6PR1201MB0177; 20:52lk5lP7EIkMEFmpnzZ7JnlgI5nm1U+w7ULLYCVVmZRR7FjiUtpaQevMlEoKY1TSt1OX6MzWGNlFsVgprZQ8ES0mo2AJW8McRgL3RK3Mc5myhgr6Q16fxKF3023aCZT4qZPLfJA03FsQueoPZRN5MmzUa2h26/GrxVNrr1X1TUmXZ4rzNtDjbfIDqPsCoBJnC8SiPBJdFnBzJYdeQlAHViQlk+bu8UgskW586hN2mMcsmV5YDfHnFOHoApdbfRy9 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Mar 2018 08:42:20.8778 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: bdaca662-8c70-4d58-7f5b-08d58d755578 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR1201MB0177 Cc: tiwai@suse.de, lgirdwood@gmail.com, djkurtz@chromium.org, akshu.agrawal@amd.com Subject: [alsa-devel] [PATCH v2 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. V2: Correcting the pin to OSCOUT1 from OSCOUT2 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..f36b4c2 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 OSCOUT1CLK25MHZ 16 + +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 << 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; +} + 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[] = {