From patchwork Mon May 15 06:51:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 99774 Delivered-To: patch@linaro.org Received: by 10.140.96.100 with SMTP id j91csp1411318qge; Sun, 14 May 2017 23:51:20 -0700 (PDT) X-Received: by 10.84.218.7 with SMTP id q7mr6290687pli.80.1494831079962; Sun, 14 May 2017 23:51:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1494831079; cv=none; d=google.com; s=arc-20160816; b=OW57D1CRi2/qZpAySEwc010cYm0C9nVx6A+4qks6D1OtZ8bO0aI+Ug+Iog2soTIbV1 qLf5+s+QtSsyB6exV+ccY8IZOom/BzArKj27KduEvIfS6nxfTynP68mgNutUiNT/VVXZ bsLFfeYuXaiDyNWAZ+KzVN6zhxcI3tq99ju80wKOgMBAGN6EiM60n2zZJ61SRNWZ3UIU jwUmMRImjZ6FqwG519cJP6kCXfADyFFizJ8fyDFVcXy9Kp2yEYHhcL6fS7q36GFlSfBo 6ENaKi32P4p8uA/enS+5XBwXYorD+yHRjipO2FwXxV0netR4nwI25e3tNdYR3P8kUTFW 0VFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:cms-type:in-reply-to :message-id:date:subject:cc:to:from:arc-authentication-results; bh=vt4m1ojcw8GQEWtcSTxBNOiOWemYD57H5xupjT/CD48=; b=uhdXHV82vamPr2WdCWPp9OmOods5WA2cOleNaiXkJd7WmeO8D2hyewChqz9jY4Bf/n kh29YQtSPwIwGVzlJtRwgggtXYc/1j+FgSXVNsA8WFDizV3uF7yKAV2Le27SzK6vVrio i733DUX1XdEN3jdlbG+PZ6dZNKafSktneFVbzS6wEHcS3vG284xHE6CskdJ/3dYrzYT1 AbWJ/OzQtqerFB9xbOITVDzFWeiRAicl1t3lwQs722wmmSepsgy7Ea6klETw6KhOC4af TCVWD3Q2FpHHft2EaPhDsgJeDhrDNWESqpEjW9n+lxBeM0WNm0XaGvU/iHJelCkTuhYs wz6w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-samsung-soc-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y17si9917185pfa.75.2017.05.14.23.51.19; Sun, 14 May 2017 23:51:19 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-samsung-soc-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932668AbdEOGvR (ORCPT + 4 others); Mon, 15 May 2017 02:51:17 -0400 Received: from mailout3.w1.samsung.com ([210.118.77.13]:9949 "EHLO mailout3.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932648AbdEOGvP (ORCPT ); Mon, 15 May 2017 02:51:15 -0400 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout3.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0OPZ006NBF1C1040@mailout3.w1.samsung.com>; Mon, 15 May 2017 07:51:12 +0100 (BST) Received: from eusmges3.samsung.com (unknown [203.254.199.242]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20170515065111eucas1p16c0187d201768124dd6d42eceee3f397~_tPCODUFX1692216922eucas1p1r; Mon, 15 May 2017 06:51:11 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges3.samsung.com (EUCPMTA) with SMTP id 3A.CC.17464.FDF49195; Mon, 15 May 2017 07:51:11 +0100 (BST) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20170515065110eucas1p1b558e1c1ce24852219aa7d98e3b57dff~_tPBTygoV2293722937eucas1p1J; Mon, 15 May 2017 06:51:10 +0000 (GMT) X-AuditID: cbfec7f2-f797e6d000004438-c4-59194fdff1ed Received: from eusync3.samsung.com ( [203.254.199.213]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 75.31.20206.FFF49195; Mon, 15 May 2017 07:51:43 +0100 (BST) Received: from AMDC2765.digital.local ([106.116.147.25]) by eusync3.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OPZ007WYF16VQ80@eusync3.samsung.com>; Mon, 15 May 2017 07:51:10 +0100 (BST) From: Marek Szyprowski To: linux-clk@vger.kernel.org, linux-samsung-soc@vger.kernel.org Cc: Marek Szyprowski , Stephen Boyd , Michael Turquette , Sylwester Nawrocki , Chanwoo Choi , Krzysztof Kozlowski , Bartlomiej Zolnierkiewicz Subject: [PATCH v3 6/6] clk: samsung: s5pv210-audss: Convert to the new clk_hw API Date: Mon, 15 May 2017 08:51:04 +0200 Message-id: <1494831064-10278-1-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1493016143-21569-7-git-send-email-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrEIsWRmVeSWpSXmKPExsWy7djPc7r3/SUjDdbfF7HYOGM9q8X1L89Z Lc6f38Bu8bHnHqvFjPP7mCzWHrnLbnHxlKvF4TftrBY/znSzOHB6vL/Ryu5xua+XyWPTqk42 j74tqxg9Pm+SC2CN4rJJSc3JLEst0rdL4Mr4/uQMc8FH/YqFfYoNjF/Uuxg5OSQETCQmrnzL CGGLSVy4t56ti5GL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LT9DiPEOjmJk8cmg8U5BTwlHn35BWYLAdVc+fqL bQIj7wJGhlWMIqmlxbnpucVGesWJucWleel6yfm5mxiB4b3t2M8tOxi73gUfYhTgYFTi4U24 LBEpxJpYVlyZe4hRgoNZSYS30EEyUog3JbGyKrUoP76oNCe1+BCjKdBRE5mlRJPzgbGXVxJv aGJobmloZGxhYW5kpCTOO/XDlXAhgfTEktTs1NSC1CKYPiYOTqkGxiNhs/Ouuy1c/DP72mb+ b029nUINF8sfns58GRaWtu+g8QOp9PtsXK4ydTr7v2Q0mAs11/YwbO1ckbCZUVRGO+LTd1em i7fe+C1sOmHqU1XLZav3IGVPwsUyoS+Hte5UXIi/fCvr1aM7GX+OtbkcapnxJTR8zqvVclGM cmlRISnWvkc/bGNjUGIpzkg01GIuKk4EAOE8vSmFAgAA X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20170515065110eucas1p1b558e1c1ce24852219aa7d98e3b57dff X-Msg-Generator: CA X-Sender-IP: 182.198.249.180 X-Local-Sender: =?utf-8?q?Marek_Szyprowski=1BSRPOL-Kernel_=28TP=29=1B?= =?utf-8?b?7IK87ISx7KCE7J6QG1NlbmlvciBTb2Z0d2FyZSBFbmdpbmVlcg==?= X-Global-Sender: =?utf-8?q?Marek_Szyprowski=1BSRPOL-Kernel_=28TP=29=1BSam?= =?utf-8?q?sung_Electronics=1BSenior_Software_Engineer?= X-Sender-Code: =?utf-8?q?C10=1BEHQ=1BC10CD02CD027392?= CMS-TYPE: 201P X-HopCount: 7 X-CMS-RootMailID: 20170515065110eucas1p1b558e1c1ce24852219aa7d98e3b57dff X-RootMTR: 20170515065110eucas1p1b558e1c1ce24852219aa7d98e3b57dff References: <1493016143-21569-7-git-send-email-m.szyprowski@samsung.com> Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org Clock providers should use the new struct clk_hw based API, so convert Samsung S5PV210 Audio Subsystem clock provider to the new approach. Signed-off-by: Marek Szyprowski Reviewed-by: Krzysztof Kozlowski --- Sylwester, if possible, please replace v2 with this fixed version in your tree, as it has not been merged yet to clk-next nor to linux-next. Changelog v3: - fixed clock data parameter passed to of_clk_add_hw_provider() - after conversion clk_data is a pointer, so passing it as &clk_data is wrong and causes serious issues --- drivers/clk/samsung/clk-s5pv210-audss.c | 52 +++++++++++++++++---------------- 1 file changed, 27 insertions(+), 25 deletions(-) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/clk/samsung/clk-s5pv210-audss.c b/drivers/clk/samsung/clk-s5pv210-audss.c index c66ed2d1450e..b9641414ddc6 100644 --- a/drivers/clk/samsung/clk-s5pv210-audss.c +++ b/drivers/clk/samsung/clk-s5pv210-audss.c @@ -24,9 +24,8 @@ #include static DEFINE_SPINLOCK(lock); -static struct clk **clk_table; static void __iomem *reg_base; -static struct clk_onecell_data clk_data; +static struct clk_hw_onecell_data *clk_data; #define ASS_CLK_SRC 0x0 #define ASS_CLK_DIV 0x4 @@ -71,6 +70,7 @@ static int s5pv210_audss_clk_probe(struct platform_device *pdev) const char *mout_audss_p[2]; const char *mout_i2s_p[3]; const char *hclk_p; + struct clk_hw **clk_table; struct clk *hclk, *pll_ref, *pll_in, *cdclk, *sclk_audio; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); @@ -80,14 +80,16 @@ static int s5pv210_audss_clk_probe(struct platform_device *pdev) return PTR_ERR(reg_base); } - clk_table = devm_kzalloc(&pdev->dev, - sizeof(struct clk *) * AUDSS_MAX_CLKS, + clk_data = devm_kzalloc(&pdev->dev, + sizeof(*clk_data) + + sizeof(*clk_data->hws) * AUDSS_MAX_CLKS, GFP_KERNEL); - if (!clk_table) + + if (!clk_data) return -ENOMEM; - clk_data.clks = clk_table; - clk_data.clk_num = AUDSS_MAX_CLKS; + clk_data->num = AUDSS_MAX_CLKS; + clk_table = clk_data->hws; hclk = devm_clk_get(&pdev->dev, "hclk"); if (IS_ERR(hclk)) { @@ -116,7 +118,7 @@ static int s5pv210_audss_clk_probe(struct platform_device *pdev) else mout_audss_p[0] = "xxti"; mout_audss_p[1] = __clk_get_name(pll_in); - clk_table[CLK_MOUT_AUDSS] = clk_register_mux(NULL, "mout_audss", + clk_table[CLK_MOUT_AUDSS] = clk_hw_register_mux(NULL, "mout_audss", mout_audss_p, ARRAY_SIZE(mout_audss_p), CLK_SET_RATE_NO_REPARENT, reg_base + ASS_CLK_SRC, 0, 1, 0, &lock); @@ -127,44 +129,44 @@ static int s5pv210_audss_clk_probe(struct platform_device *pdev) else mout_i2s_p[1] = "iiscdclk0"; mout_i2s_p[2] = __clk_get_name(sclk_audio); - clk_table[CLK_MOUT_I2S_A] = clk_register_mux(NULL, "mout_i2s_audss", + clk_table[CLK_MOUT_I2S_A] = clk_hw_register_mux(NULL, "mout_i2s_audss", mout_i2s_p, ARRAY_SIZE(mout_i2s_p), CLK_SET_RATE_NO_REPARENT, reg_base + ASS_CLK_SRC, 2, 2, 0, &lock); - clk_table[CLK_DOUT_AUD_BUS] = clk_register_divider(NULL, + clk_table[CLK_DOUT_AUD_BUS] = clk_hw_register_divider(NULL, "dout_aud_bus", "mout_audss", 0, reg_base + ASS_CLK_DIV, 0, 4, 0, &lock); - clk_table[CLK_DOUT_I2S_A] = clk_register_divider(NULL, "dout_i2s_audss", - "mout_i2s_audss", 0, reg_base + ASS_CLK_DIV, - 4, 4, 0, &lock); + clk_table[CLK_DOUT_I2S_A] = clk_hw_register_divider(NULL, + "dout_i2s_audss", "mout_i2s_audss", 0, + reg_base + ASS_CLK_DIV, 4, 4, 0, &lock); - clk_table[CLK_I2S] = clk_register_gate(NULL, "i2s_audss", + clk_table[CLK_I2S] = clk_hw_register_gate(NULL, "i2s_audss", "dout_i2s_audss", CLK_SET_RATE_PARENT, reg_base + ASS_CLK_GATE, 6, 0, &lock); hclk_p = __clk_get_name(hclk); - clk_table[CLK_HCLK_I2S] = clk_register_gate(NULL, "hclk_i2s_audss", + clk_table[CLK_HCLK_I2S] = clk_hw_register_gate(NULL, "hclk_i2s_audss", hclk_p, CLK_IGNORE_UNUSED, reg_base + ASS_CLK_GATE, 5, 0, &lock); - clk_table[CLK_HCLK_UART] = clk_register_gate(NULL, "hclk_uart_audss", + clk_table[CLK_HCLK_UART] = clk_hw_register_gate(NULL, "hclk_uart_audss", hclk_p, CLK_IGNORE_UNUSED, reg_base + ASS_CLK_GATE, 4, 0, &lock); - clk_table[CLK_HCLK_HWA] = clk_register_gate(NULL, "hclk_hwa_audss", + clk_table[CLK_HCLK_HWA] = clk_hw_register_gate(NULL, "hclk_hwa_audss", hclk_p, CLK_IGNORE_UNUSED, reg_base + ASS_CLK_GATE, 3, 0, &lock); - clk_table[CLK_HCLK_DMA] = clk_register_gate(NULL, "hclk_dma_audss", + clk_table[CLK_HCLK_DMA] = clk_hw_register_gate(NULL, "hclk_dma_audss", hclk_p, CLK_IGNORE_UNUSED, reg_base + ASS_CLK_GATE, 2, 0, &lock); - clk_table[CLK_HCLK_BUF] = clk_register_gate(NULL, "hclk_buf_audss", + clk_table[CLK_HCLK_BUF] = clk_hw_register_gate(NULL, "hclk_buf_audss", hclk_p, CLK_IGNORE_UNUSED, reg_base + ASS_CLK_GATE, 1, 0, &lock); - clk_table[CLK_HCLK_RP] = clk_register_gate(NULL, "hclk_rp_audss", + clk_table[CLK_HCLK_RP] = clk_hw_register_gate(NULL, "hclk_rp_audss", hclk_p, CLK_IGNORE_UNUSED, reg_base + ASS_CLK_GATE, 0, 0, &lock); - for (i = 0; i < clk_data.clk_num; i++) { + for (i = 0; i < clk_data->num; i++) { if (IS_ERR(clk_table[i])) { dev_err(&pdev->dev, "failed to register clock %d\n", i); ret = PTR_ERR(clk_table[i]); @@ -172,8 +174,8 @@ static int s5pv210_audss_clk_probe(struct platform_device *pdev) } } - ret = of_clk_add_provider(pdev->dev.of_node, of_clk_src_onecell_get, - &clk_data); + ret = of_clk_add_hw_provider(pdev->dev.of_node, of_clk_hw_onecell_get, + clk_data); if (ret) { dev_err(&pdev->dev, "failed to add clock provider\n"); goto unregister; @@ -186,9 +188,9 @@ static int s5pv210_audss_clk_probe(struct platform_device *pdev) return 0; unregister: - for (i = 0; i < clk_data.clk_num; i++) { + for (i = 0; i < clk_data->num; i++) { if (!IS_ERR(clk_table[i])) - clk_unregister(clk_table[i]); + clk_hw_unregister(clk_table[i]); } return ret;