From patchwork Mon Feb 5 15:43:57 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: 10200787 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 4EB996056A for ; Mon, 5 Feb 2018 15:45:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3F3F628778 for ; Mon, 5 Feb 2018 15:45:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 338872877F; Mon, 5 Feb 2018 15:45:19 +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=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 88B0328778 for ; Mon, 5 Feb 2018 15:45:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753263AbeBEPpR (ORCPT ); Mon, 5 Feb 2018 10:45:17 -0500 Received: from mailout2.samsung.com ([203.254.224.25]:16402 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752925AbeBEPpO (ORCPT ); Mon, 5 Feb 2018 10:45:14 -0500 Received: from epcas1p4.samsung.com (unknown [182.195.41.48]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20180205154513epoutp0270c2a0ba7424db749809d07f71389e8a~QeHPCZl6u3222732227epoutp02K; Mon, 5 Feb 2018 15:45:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20180205154513epoutp0270c2a0ba7424db749809d07f71389e8a~QeHPCZl6u3222732227epoutp02K DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1517845513; bh=vJuDd7l3/d4hgRAHc9jHrI96+9IBtqUXP1UYLWrBo9c=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=eOR/bUB8avTIb7fkIClLay5DC9ztg4aA5BhFg6tALV90mMmWw9dHvAq0KqcdmpZjb Fi4N/4o8Ex2ULZmgNQcXEQoLvVwqet+tV1ivsaveqMIA9OeXnI4d/lE4DdMP3mZfDD kcK9euAtDNzJ6A+d+x0l5I2HNgG+e2Lxt4FJ4ygQ= Received: from epsmges1p3.samsung.com (unknown [182.195.42.55]) by epcas1p1.samsung.com (KnoxPortal) with ESMTP id 20180205154512epcas1p18520cefc8eccd3de511d2047ca60a330~QeHOsf6oB1832618326epcas1p1N; Mon, 5 Feb 2018 15:45:12 +0000 (GMT) Received: from epcas1p4.samsung.com ( [182.195.41.48]) by epsmges1p3.samsung.com (Symantec Messaging Gateway) with SMTP id 33.96.04137.80C787A5; Tue, 6 Feb 2018 00:45:12 +0900 (KST) Received: from epsmgms2p1new.samsung.com (unknown [182.195.42.142]) by epcas1p1.samsung.com (KnoxPortal) with ESMTP id 20180205154511epcas1p14dccb00b68fdb688f2c427c56e01c052~QeHNvtg_g1878018780epcas1p1G; Mon, 5 Feb 2018 15:45:11 +0000 (GMT) X-AuditID: b6c32a37-433ff70000001029-47-5a787c083c2a Received: from epmmp1.local.host ( [203.254.227.16]) by epsmgms2p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 30.92.03826.70C787A5; Tue, 6 Feb 2018 00:45:11 +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 <0P3O00399P1LBQ40@mmp1.samsung.com>; Tue, 06 Feb 2018 00:45:11 +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 2/8] ASoC: samsung: i2s: Ensure names of supplied clocks are unique Date: Mon, 05 Feb 2018 16:43:57 +0100 Message-id: <20180205154403.13520-3-s.nawrocki@samsung.com> X-Mailer: git-send-email 2.14.2 In-reply-to: <20180205154403.13520-1-s.nawrocki@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrEIsWRmVeSWpSXmKPExsWy7bCmgS5HTUWUwfRXihZXLh5istg4Yz2r xdSHT9gs5h85x2rxdn83s8X58xvYLb5d6WCyuLxrDpvFjPP7mCzWHrnLbtG69wi7xeE37awW F1d8YXLg9djwuYnNY+esu+wem1Z1snn0bVnF6PF5k1wAaxSXTUpqTmZZapG+XQJXRuffn8wF 0yUq7vc+Ym1g/C/cxcjJISFgItF5ppm5i5GLQ0hgB6PE7z1TGUESQgLfGSWefTCCKVp4YAUj RNFuRok1Fy6wQRT9YpToes4BYrMJGEr0Hu0DaxYREJO4PacTbCqzwBkmien71jCBJIQFQiWO 9UA0swioSvw4+IYdxOYVsJaYtmEPC8Q2eYn3C+6DDeIUsJHYc28Z2GYJgR1sEou+/WKEKHKR eLzgC1SDsMSr41uABnEA2dISl47aQtT3M0qcWNMM1TyDUeJO+wQmiAZricPHL7KC2MwCfBLv vvawQjTzSnS0CUGUeEjs+LIYar6jxO/Vy9gg3gcaeu7GZpYJjFILGBlWMYqlFhTnpqcWGxYY 6xUn5haX5qXrJefnbmIEx7SW+Q7GDed8DjEKcDAq8fAKZFRECbEmlhVX5h5ilOBgVhLhdbpe HiXEm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1p14dccb00b68fdb688f2c427c56e01c052 X-Msg-Generator: CA CMS-TYPE: 101P X-CMS-RootMailID: 20180205154511epcas1p14dccb00b68fdb688f2c427c56e01c052 X-RootMTR: 20180205154511epcas1p14dccb00b68fdb688f2c427c56e01c052 References: <20180205154403.13520-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 --- sound/soc/samsung/i2s.c | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c index aeba0ae890ea..b7d25a63da8b 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,35 @@ 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->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);