From patchwork Tue Aug 16 13:35:09 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 9284031 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 D1DCE60839 for ; Tue, 16 Aug 2016 14:14:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C6DB228D41 for ; Tue, 16 Aug 2016 14:14:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BB4BD28E8E; Tue, 16 Aug 2016 14:14:44 +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.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE autolearn=unavailable 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 6C9F128D41 for ; Tue, 16 Aug 2016 14:14:43 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 11604266CC2; Tue, 16 Aug 2016 16:14:42 +0200 (CEST) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id BEB0C266917; Tue, 16 Aug 2016 16:08:27 +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 AD5722668D1; Tue, 16 Aug 2016 16:08:21 +0200 (CEST) Received: from mailout4.w1.samsung.com (mailout4.w1.samsung.com [210.118.77.14]) by alsa0.perex.cz (Postfix) with ESMTP id 7FE7B2668D9 for ; Tue, 16 Aug 2016 15:36:42 +0200 (CEST) Received: from eucpsbgm1.samsung.com (unknown [203.254.199.244]) by mailout4.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0OC0008AI8H5KQ30@mailout4.w1.samsung.com> for alsa-devel@alsa-project.org; Tue, 16 Aug 2016 14:36:42 +0100 (BST) X-AuditID: cbfec7f4-f796c6d000001486-ad-57b316e98271 Received: from eusync3.samsung.com ( [203.254.199.213]) by eucpsbgm1.samsung.com (EUCPMTA) with SMTP id 58.3D.05254.9E613B75; Tue, 16 Aug 2016 14:36:41 +0100 (BST) Received: from AMDC2174.DIGITAL.local ([106.120.53.17]) by eusync3.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OC000MRK8GNJF30@eusync3.samsung.com>; Tue, 16 Aug 2016 14:36:41 +0100 (BST) From: Krzysztof Kozlowski To: Michael Turquette , Stephen Boyd , Stephen Warren , Lee Jones , Eric Anholt , Florian Fainelli , Ray Jui , Scott Branden , bcm-kernel-feedback-list@broadcom.com, Krzysztof Kozlowski , Sylwester Nawrocki , Tomasz Figa , Kukjin Kim , Russell King , Mark Brown , linux-clk@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-i2c@vger.kernel.org, alsa-devel@alsa-project.org Date: Tue, 16 Aug 2016 15:35:09 +0200 Message-id: <1471354514-24224-13-git-send-email-k.kozlowski@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1471354514-24224-1-git-send-email-k.kozlowski@samsung.com> References: <1471354514-24224-1-git-send-email-k.kozlowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrEIsWRmVeSWpSXmKPExsVy+t/xq7ovxTaHG7w8q2Zxa905VosrFw8x WWycsZ7VYm3vURaLqQ+fsFn8m3KD3eJA42VGi1/vjrBbvHm7hsni9QtDi/7Hr5ktdrQtZLHY 9Pgaq8XHnnusFh1/vzBaXN41h81i4u0N7BYzzu9jsjg0dS+jxdojd9ktLp5ytXg6czObxeE3 7awWP850s1i8W/2E0eLVwTYWi1W7/jA6SHts+NzE5tH0/hibx+VrF5k93t9oZfeYdf8skNvX y+Sxc9Zddo9NqzrZPDYvqfd4OfE3m8eWfqBQ35ZVjB6fN8l5bJwbGsAXxWWTkpqTWZZapG+X wJVxf/Me9oLHwhXPutcyNjDuE+hi5OSQEDCRuHf2FhuELSZx4d56IJuLQ0hgKaPE1cm3oJxG Jom/U34zgVSxCRhLbF6+BCwhIrCKTWLh37VMIA6zwEtGibMnf4FVCQu4STy/3M0IYrMIqEpM WbKMtYuRg4NXwEPiUhsfxDo5iZPHJrOC2JxA4XMXGplBbCEBd4mT69tZJjDyLmBkWMUomlqa XFCclJ5rqFecmFtcmpeul5yfu4kREnNfdjAuPmZ1iFGAg1GJh/ckw6ZwIdbEsuLK3EOMEhzM SiK8h0U3hwvxpiRWVqUW5ccXleakFh9ilOZgURLnnbvrfYiQQHpiSWp2ampBahFMlomDU6qB cVW44sStnRo31ue+XeiaW3VyovC2P96MfzYvSMy79ypT21buwZ2P6ZXaQRtP9btu6PeWkvlu brFd8eMxt/4TPDtMvOY3pd+/ce+4UG7m+UYdu9SAlk03LF4UzwqaI37dsbvq2woegeRpgQGr Sk33m5x8xziz0sRvz5a9U0p/HPXzXbnBLWWTqBJLcUaioRZzUXEiAICcaZS1AgAA Cc: a.hajda@samsung.com, Javier Martinez Canillas , Charles Keepax , Bartlomiej Zolnierkiewicz , Marek Szyprowski Subject: [alsa-devel] [RFC 12/17] ASoC: samsung: Switch to new clock controller API 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: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP Allocate a clock controller and use new clk_register_with_ctrl() API. Signed-off-by: Krzysztof Kozlowski Acked-by: Mark Brown --- sound/soc/samsung/i2s.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c index fa3ff03d97d5..1ec90daa4df4 100644 --- a/sound/soc/samsung/i2s.c +++ b/sound/soc/samsung/i2s.c @@ -104,6 +104,7 @@ struct i2s_dai { /* Below fields are only valid if this is the primary FIFO */ struct clk *clk_table[3]; struct clk_onecell_data clk_data; + struct clk_ctrl *clk_ctrl; }; /* Lock for cross i/f checks */ @@ -1148,6 +1149,7 @@ static void i2s_unregister_clock_provider(struct platform_device *pdev) of_clk_del_provider(pdev->dev.of_node); i2s_unregister_clocks(i2s); + clk_ctrl_unregister(i2s->clk_ctrl); } static int i2s_register_clock_provider(struct platform_device *pdev) @@ -1164,6 +1166,10 @@ static int i2s_register_clock_provider(struct platform_device *pdev) if (!of_find_property(dev->of_node, "#clock-cells", NULL)) return 0; + i2s->clk_ctrl = clk_ctrl_register(dev); + if (IS_ERR(i2s->clk_ctrl)) + return PTR_ERR(i2s->clk_ctrl); + /* Get the RCLKSRC mux clock parent clock names */ for (i = 0; i < ARRAY_SIZE(p_names); i++) { rclksrc = clk_get(dev, clk_name[i]); @@ -1179,13 +1185,14 @@ static int i2s_register_clock_provider(struct platform_device *pdev) writel(val | PSR_PSREN, i2s->addr + I2SPSR); i2s->clk_table[CLK_I2S_RCLK_SRC] = clk_register_mux(NULL, + i2s->clk_ctrl, "i2s_rclksrc", p_names, ARRAY_SIZE(p_names), CLK_SET_RATE_NO_REPARENT | CLK_SET_RATE_PARENT, i2s->addr + I2SMOD, reg_info->rclksrc_off, 1, 0, i2s->lock); i2s->clk_table[CLK_I2S_RCLK_PSR] = clk_register_divider(NULL, - "i2s_presc", "i2s_rclksrc", + i2s->clk_ctrl, "i2s_presc", "i2s_rclksrc", CLK_SET_RATE_PARENT, i2s->addr + I2SPSR, 8, 6, 0, i2s->lock); @@ -1195,8 +1202,8 @@ static int i2s_register_clock_provider(struct platform_device *pdev) of_property_read_string_index(dev->of_node, "clock-output-names", 0, &clk_name[0]); - i2s->clk_table[CLK_I2S_CDCLK] = clk_register_gate(NULL, clk_name[0], - p_names[0], CLK_SET_RATE_PARENT, + i2s->clk_table[CLK_I2S_CDCLK] = clk_register_gate(NULL, i2s->clk_ctrl, + clk_name[0], p_names[0], CLK_SET_RATE_PARENT, i2s->addr + I2SMOD, reg_info->cdclkcon_off, CLK_GATE_SET_TO_DISABLE, i2s->lock);