From patchwork Tue Feb 12 18:03:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Sylwester Nawrocki/Kernel \\(PLT\\) /SRPOL/Staff Engineer/Samsung Electronics" X-Patchwork-Id: 10808501 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 743E713BF for ; Tue, 12 Feb 2019 18:07:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 614F62C3C1 for ; Tue, 12 Feb 2019 18:07:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4DB5D2C3B2; Tue, 12 Feb 2019 18:07:00 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3296D2C361 for ; Tue, 12 Feb 2019 18:06:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728479AbfBLSGr (ORCPT ); Tue, 12 Feb 2019 13:06:47 -0500 Received: from mailout3.samsung.com ([203.254.224.33]:59155 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731336AbfBLSE4 (ORCPT ); Tue, 12 Feb 2019 13:04:56 -0500 Received: from epcas2p1.samsung.com (unknown [182.195.41.53]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20190212180453epoutp0329e053f933681489a382eb301d098490~Cr-Yhs3Fu2783327833epoutp03b; Tue, 12 Feb 2019 18:04:53 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20190212180453epoutp0329e053f933681489a382eb301d098490~Cr-Yhs3Fu2783327833epoutp03b DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1549994693; bh=TtQx0G720ISMtzrhrffDlH6r+gc+72B0lf9feRyYaAs=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=BvOcpNFDVnOmvbBY7RTDQqZ824Svh3JrXr86sEH1Uw4IwCZO76Uz+sgweEhEf+MyA zZM43uKg0syIj/mE1m/QO7lAPJm0VLll35rQMwUFn98pRqrmhUuETqXp/Tdgip9yaU w/Gn35tUYwrY0KvpECHagbILxapnEqnZQ3cofPKo= Received: from epsmges2p3.samsung.com (unknown [182.195.42.71]) by epcas2p2.samsung.com (KnoxPortal) with ESMTP id 20190212180452epcas2p205583b1d6554d72f891e3bf7e512ac73~Cr-YA-_6T2848628486epcas2p2J; Tue, 12 Feb 2019 18:04:52 +0000 (GMT) Received: from epcas2p3.samsung.com ( [182.195.41.55]) by epsmges2p3.samsung.com (Symantec Messaging Gateway) with SMTP id BE.29.04134.4CA036C5; Wed, 13 Feb 2019 03:04:52 +0900 (KST) Received: from epsmgms2p2new.samsung.com (unknown [182.195.42.143]) by epcas2p2.samsung.com (KnoxPortal) with ESMTP id 20190212180452epcas2p2f162435a99743c654320219dd25f880b~Cr-XqWIZo1862418624epcas2p2E; Tue, 12 Feb 2019 18:04:52 +0000 (GMT) X-AuditID: b6c32a47-8abff70000001026-46-5c630ac4d149 Received: from epmmp2 ( [203.254.227.17]) by epsmgms2p2new.samsung.com (Symantec Messaging Gateway) with SMTP id 87.30.03689.4CA036C5; Wed, 13 Feb 2019 03:04:52 +0900 (KST) Received: from AMDC3061.digital.local ([106.116.147.40]) by mmp2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0PMT0024XRJ2FB10@mmp2.samsung.com>; Wed, 13 Feb 2019 03:04:52 +0900 (KST) From: Sylwester Nawrocki To: broonie@kernel.org Cc: lgirdwood@gmail.com, krzk@kernel.org, sbkim73@samsung.com, m.szyprowski@samsung.com, b.zolnierkie@samsung.com, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, Sylwester Nawrocki Subject: [PATCH v2 04/21] ASoC: samsung: i2s: Move core clk to the driver common data structure Date: Tue, 12 Feb 2019 19:03:25 +0100 Message-id: <20190212180342.32040-5-s.nawrocki@samsung.com> X-Mailer: git-send-email 2.20.1 In-reply-to: <20190212180342.32040-1-s.nawrocki@samsung.com> MIME-version: 1.0 Content-transfer-encoding: 8bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrNIsWRmVeSWpSXmKPExsWy7bCmue4RruQYg0cHjSyuXDzEZLFxxnpW i6kPn7BZnD+/gd3i25UOJovLu+awWcw4v4/JYu2Ru+wWh9+0s1pcXPGFyYHLY8PnJjaPnbPu sntsWtXJ5tG3ZRWjx+dNcgGsUVw2Kak5mWWpRfp2CVwZWxbMYynolq9Y/vUQUwPjBckuRg4O CQETiaYbWV2MXBxCAjsYJTa9+cIC4XxnlLgw5xZjFyMnWFHrsnlsEIkNjBKz/vxhh3B+MUoc WvWVGaSKTcBQovdoH1iHiICYxO05ncwgRcwCLUwSc+YuBSsSFkiU+Lb6DiPIbhYBVYnGOW4g YV4Ba4k1ve+htslLnO9dxw5icwrYSDxb+I0FokZQ4sfke2A2M1DNwSvPwU6VEDjCJtE37ygL RLOLxNamx0wQtrTEs1UboYZWS+za3s0M0dDBKNFyYTszRMJa4vDxi6wQU/kkOg7/ZYcEDK9E R5sQRImHxL5FX6De72eU+HH/KssERqlZSI6aheSoBYxMqxjFUguKc9NTi40KjPWKE3OLS/PS 9ZLzczcxgqNcy30H47ZzPocYBTgYlXh4VxxNihFiTSwrrsw9xCjBwawkwpvGnBwjxJuSWFm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452epcas2p2f162435a99743c654320219dd25f880b CMS-TYPE: 102P X-CMS-RootMailID: 20190212180452epcas2p2f162435a99743c654320219dd25f880b References: <20190212180342.32040-1-s.nawrocki@samsung.com> Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The core clock is also common for both CPU DAIs so move it to the driver's private data structure. Signed-off-by: Sylwester Nawrocki Acked-by: Krzysztof Kozlowski --- sound/soc/samsung/i2s.c | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c index 29bcfca20572..159c19fdb662 100644 --- a/sound/soc/samsung/i2s.c +++ b/sound/soc/samsung/i2s.c @@ -71,8 +71,6 @@ struct i2s_dai { * 0 indicates CPU driver is free to choose any value. */ unsigned rfs, bfs; - /* I2S Controller's core clock */ - struct clk *clk; /* Clock for generating I2S signals */ struct clk *op_clk; /* Pointer to the Primary_Fifo if this is Sec_Fifo, NULL otherwise */ @@ -117,6 +115,9 @@ struct samsung_i2s_priv { struct snd_soc_dai_driver *dai_drv; int num_dais; + /* The I2S controller's core clock */ + struct clk *clk; + /* The clock provider's data */ struct clk *clk_table[3]; struct clk_onecell_data clk_data; @@ -1205,6 +1206,7 @@ static int i2s_alloc_dais(struct samsung_i2s_priv *priv, #ifdef CONFIG_PM static int i2s_runtime_suspend(struct device *dev) { + struct samsung_i2s_priv *priv = dev_get_drvdata(dev); struct i2s_dai *i2s = samsung_i2s_get_pri_dai(dev); i2s->suspend_i2smod = readl(i2s->addr + I2SMOD); @@ -1213,24 +1215,25 @@ static int i2s_runtime_suspend(struct device *dev) if (i2s->op_clk) clk_disable_unprepare(i2s->op_clk); - clk_disable_unprepare(i2s->clk); + clk_disable_unprepare(priv->clk); return 0; } static int i2s_runtime_resume(struct device *dev) { + struct samsung_i2s_priv *priv = dev_get_drvdata(dev); struct i2s_dai *i2s = samsung_i2s_get_pri_dai(dev); int ret; - ret = clk_prepare_enable(i2s->clk); + ret = clk_prepare_enable(priv->clk); if (ret) return ret; if (i2s->op_clk) { ret = clk_prepare_enable(i2s->op_clk); if (ret) { - clk_disable_unprepare(i2s->clk); + clk_disable_unprepare(priv->clk); return ret; } } @@ -1428,13 +1431,13 @@ static int samsung_i2s_probe(struct platform_device *pdev) regs_base = res->start; - pri_dai->clk = devm_clk_get(&pdev->dev, "iis"); - if (IS_ERR(pri_dai->clk)) { + priv->clk = devm_clk_get(&pdev->dev, "iis"); + if (IS_ERR(priv->clk)) { dev_err(&pdev->dev, "Failed to get iis clock\n"); - return PTR_ERR(pri_dai->clk); + return PTR_ERR(priv->clk); } - ret = clk_prepare_enable(pri_dai->clk); + ret = clk_prepare_enable(priv->clk); if (ret != 0) { dev_err(&pdev->dev, "failed to enable clock: %d\n", ret); return ret; @@ -1472,7 +1475,6 @@ static int samsung_i2s_probe(struct platform_device *pdev) sec_dai->dma_playback.addr_width = 4; sec_dai->addr = pri_dai->addr; - sec_dai->clk = pri_dai->clk; sec_dai->quirks = quirks; sec_dai->idma_playback.addr = idma_addr; sec_dai->pri_dai = pri_dai; @@ -1519,7 +1521,7 @@ static int samsung_i2s_probe(struct platform_device *pdev) err_disable_pm: pm_runtime_disable(&pdev->dev); err_disable_clk: - clk_disable_unprepare(pri_dai->clk); + clk_disable_unprepare(priv->clk); i2s_delete_secondary_device(priv); return ret; } @@ -1527,7 +1529,6 @@ static int samsung_i2s_probe(struct platform_device *pdev) static int samsung_i2s_remove(struct platform_device *pdev) { struct samsung_i2s_priv *priv = dev_get_drvdata(&pdev->dev); - struct i2s_dai *pri_dai = samsung_i2s_get_pri_dai(&pdev->dev); /* The secondary device has no driver data assigned */ if (!priv) @@ -1537,7 +1538,7 @@ static int samsung_i2s_remove(struct platform_device *pdev) pm_runtime_disable(&pdev->dev); i2s_unregister_clock_provider(priv); - clk_disable_unprepare(pri_dai->clk); + clk_disable_unprepare(priv->clk); pm_runtime_put_noidle(&pdev->dev); i2s_delete_secondary_device(priv);