From patchwork Mon Feb 12 16:15:33 2018 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: 10213503 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 49A9D6055C for ; Mon, 12 Feb 2018 16:19:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3AE0628CA7 for ; Mon, 12 Feb 2018 16:19:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2F1A928CD9; Mon, 12 Feb 2018 16:19:01 +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=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=unavailable 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 C9AA928CC3 for ; Mon, 12 Feb 2018 16:19:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935294AbeBLQQv (ORCPT ); Mon, 12 Feb 2018 11:16:51 -0500 Received: from mailout3.samsung.com ([203.254.224.33]:12865 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935579AbeBLQQp (ORCPT ); Mon, 12 Feb 2018 11:16:45 -0500 Received: from epcas1p3.samsung.com (unknown [182.195.41.47]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20180212161643epoutp03f6cafd19aa60617339901205bcc4307e~SoDvU5asx2297922979epoutp03B; Mon, 12 Feb 2018 16:16:43 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20180212161643epoutp03f6cafd19aa60617339901205bcc4307e~SoDvU5asx2297922979epoutp03B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1518452203; bh=EsKqz6ZMW+rFXjfeR0rD1rmm3B4WEhhJfcMSO3gP2us=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=iOxu34QUci05vnEs4d4jlwhPkQDE3cOt+7yvh9cYAlBdCGTeo5rQPaoD5WioKPZgN MtEVu8irJQ3HnNIp9FChTrnqcdWmJAKXeCAmU/0WdQD0fQ9B8h3ZMIyhaxAwChOIeZ 9cY7wG+kpX1E82TbgjeTY2TONBeQpmWXFrok5bF8= Received: from epsmges1p1.samsung.com (unknown [182.195.42.53]) by epcas1p2.samsung.com (KnoxPortal) with ESMTP id 20180212161642epcas1p27f7e7f3a856d003c8036d245034e96cc~SoDuu79yt2028720287epcas1p2W; Mon, 12 Feb 2018 16:16:42 +0000 (GMT) Received: from epcas1p3.samsung.com ( [182.195.41.47]) by epsmges1p1.samsung.com (Symantec Messaging Gateway) with SMTP id E6.04.04145.AEDB18A5; Tue, 13 Feb 2018 01:16:42 +0900 (KST) Received: from epsmgms2p1new.samsung.com (unknown [182.195.42.142]) by epcas1p2.samsung.com (KnoxPortal) with ESMTP id 20180212161641epcas1p2418c2323e5eb99a37a89b42c246f23dd~SoDuKKxe12028820288epcas1p2T; Mon, 12 Feb 2018 16:16:41 +0000 (GMT) X-AuditID: b6c32a35-891ff70000001031-2b-5a81bdea614b Received: from epmmp1.local.host ( [203.254.227.16]) by epsmgms2p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 94.48.03826.9EDB18A5; Tue, 13 Feb 2018 01:16:41 +0900 (KST) Received: from AMDC3061.digital.local ([106.116.147.40]) by mmp1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0P4100BF1P6787A0@mmp1.samsung.com>; Tue, 13 Feb 2018 01:16:41 +0900 (KST) From: Sylwester Nawrocki To: broonie@kernel.org Cc: lgirdwood@gmail.com, alsa-devel@alsa-project.org, robh+dt@kernel.org, devicetree@vger.kernel.org, linux-samsung-soc@vger.kernel.org, krzk@kernel.org, jcsing.lee@samsung.com, sbkim73@samsung.com, linux-kernel@vger.kernel.org, b.zolnierkie@samsung.com, m.szyprowski@samsung.com, Sylwester Nawrocki Subject: [PATCH v2 2/7] ASoC: samsung: i2s: Ensure names of supplied clocks are unique Date: Mon, 12 Feb 2018 17:15:33 +0100 Message-id: <20180212161538.22669-3-s.nawrocki@samsung.com> X-Mailer: git-send-email 2.14.2 In-reply-to: <20180212161538.22669-1-s.nawrocki@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrIIsWRmVeSWpSXmKPExsWy7bCmvu6rvY1RBn+fyFlcuXiIyWLjjPWs FlMfPmGzmH/kHKvF2/3dzBbnz29gt/h2pYPJ4vKuOWwWM87vY7JYe+Quu0Xr3iPsFofftLNa XFzxhcmB12PD5yY2j52z7rJ7bFrVyebRt2UVo8fnTXIBrFFcNimpOZllqUX6dglcGT27L7AV TJasOHb0L3MD432RLkZODgkBE4lPs+awdjFycQgJ7GCUuDntNROE851RonnFaXaYqr9rlkFV 7WaU+HnkPTNIQkjgF6PE9VWpIDabgKFE79E+RhBbREBM4vacTmaQBmaBM0wS0/etYQJJCAtE SHx4dgjMZhFQlVj8vQuoiIODV8BaYmeXKMQyeYn3C+6DzeEUsJGYdHk52EUSAjvYJO6f7mGG KHKR+NP2kRHCFpZ4dXwLO8gcCQFpiUtHbSHq+xklPh7fzwLhrGaUeP1tFytEg7XE4eMXwWxm AT6Jd197WCGaeSU62oQgSjwk+r7fYYQIO0pMvmMG8TzQzNMPN7JMYJRawMiwilEstaA4Nz21 2LDAUK84Mbe4NC9dLzk/dxMjOKK1THcwTjnnc4hRgINRiYe3Y3ZjlBBrYllxZe4hRgk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180212161641epcas1p2418c2323e5eb99a37a89b42c246f23dd X-Msg-Generator: CA CMS-TYPE: 101P X-CMS-RootMailID: 20180212161641epcas1p2418c2323e5eb99a37a89b42c246f23dd X-RootMTR: 20180212161641epcas1p2418c2323e5eb99a37a89b42c246f23dd References: <20180212161538.22669-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 In order to support multiple instances of the I2S IP block the platform device name is prepended to each clock registered by the driver. The clock-output-names property is now not used, this should not cause any issues as, for example, CDCLK clock is referenced through DT 'clocks' property, not by name. This change allows to have both I2S0 and I2S1 enabled simultaneously on exynos5433 and working properly when #clock-cells property is specified in respective DT nodes. Signed-off-by: Sylwester Nawrocki Acked-by: Krzysztof Kozlowski --- Changes since v1: - added devm_kasprintf() error handling. --- sound/soc/samsung/i2s.c | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c index aeba0ae890ea..5088d12faeda 100644 --- a/sound/soc/samsung/i2s.c +++ b/sound/soc/samsung/i2s.c @@ -1193,11 +1193,13 @@ static void i2s_unregister_clock_provider(struct platform_device *pdev) static int i2s_register_clock_provider(struct platform_device *pdev) { - struct device *dev = &pdev->dev; - struct i2s_dai *i2s = dev_get_drvdata(dev); + const char * const i2s_clk_desc[] = { "cdclk", "rclk_src", "prescaler" }; const char *clk_name[2] = { "i2s_opclk0", "i2s_opclk1" }; const char *p_names[2] = { NULL }; + struct device *dev = &pdev->dev; + struct i2s_dai *i2s = dev_get_drvdata(dev); const struct samsung_i2s_variant_regs *reg_info = i2s->variant_regs; + const char *i2s_clk_name[ARRAY_SIZE(i2s_clk_desc)]; struct clk *rclksrc; int ret, i; @@ -1214,30 +1216,38 @@ static int i2s_register_clock_provider(struct platform_device *pdev) clk_put(rclksrc); } + for (i = 0; i < ARRAY_SIZE(i2s_clk_desc); i++) { + i2s_clk_name[i] = devm_kasprintf(dev, GFP_KERNEL, "%s_%s", + dev_name(dev), i2s_clk_desc[i]); + if (!i2s_clk_name[i]) + return -ENOMEM; + } + if (!(i2s->quirks & QUIRK_NO_MUXPSR)) { /* Activate the prescaler */ u32 val = readl(i2s->addr + I2SPSR); writel(val | PSR_PSREN, i2s->addr + I2SPSR); i2s->clk_table[CLK_I2S_RCLK_SRC] = clk_register_mux(dev, - "i2s_rclksrc", p_names, ARRAY_SIZE(p_names), + i2s_clk_name[CLK_I2S_RCLK_SRC], 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(dev, - "i2s_presc", "i2s_rclksrc", + i2s_clk_name[CLK_I2S_RCLK_PSR], + i2s_clk_name[CLK_I2S_RCLK_SRC], CLK_SET_RATE_PARENT, i2s->addr + I2SPSR, 8, 6, 0, i2s->lock); - p_names[0] = "i2s_presc"; + p_names[0] = i2s_clk_name[CLK_I2S_RCLK_PSR]; i2s->clk_data.clk_num = 2; } - of_property_read_string_index(dev->of_node, - "clock-output-names", 0, &clk_name[0]); - i2s->clk_table[CLK_I2S_CDCLK] = clk_register_gate(dev, clk_name[0], - p_names[0], CLK_SET_RATE_PARENT, + i2s->clk_table[CLK_I2S_CDCLK] = clk_register_gate(dev, + i2s_clk_name[CLK_I2S_CDCLK], p_names[0], + CLK_SET_RATE_PARENT, i2s->addr + I2SMOD, reg_info->cdclkcon_off, CLK_GATE_SET_TO_DISABLE, i2s->lock);