From patchwork Mon Dec 5 05:23:56 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 9460301 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 E4ABE60236 for ; Mon, 5 Dec 2016 05:26:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D73E51FEC1 for ; Mon, 5 Dec 2016 05:26:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C8E282621D; Mon, 5 Dec 2016 05:26:42 +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=-4.1 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED,RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4F06A1FEC1 for ; Mon, 5 Dec 2016 05:26:42 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1cDllQ-0003gC-0b; Mon, 05 Dec 2016 05:24:32 +0000 Received: from relmlor3.renesas.com ([210.160.252.173] helo=relmlie2.idc.renesas.com) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1cDllH-0003UB-CC for linux-arm-kernel@lists.infradead.org; Mon, 05 Dec 2016 05:24:27 +0000 Received: from unknown (HELO relmlir2.idc.renesas.com) ([10.200.68.152]) by relmlie2.idc.renesas.com with ESMTP; 05 Dec 2016 14:24:01 +0900 Received: from relmlac3.idc.renesas.com (relmlac3.idc.renesas.com [10.200.69.23]) by relmlir2.idc.renesas.com (Postfix) with ESMTP id 3598C50132; Mon, 5 Dec 2016 14:24:01 +0900 (JST) Received: by relmlac3.idc.renesas.com (Postfix, from userid 0) id 2D54D18071; Mon, 5 Dec 2016 14:24:01 +0900 (JST) Received: from relmlac3.idc.renesas.com (localhost [127.0.0.1]) by relmlac3.idc.renesas.com (Postfix) with ESMTP id 279381806F; Mon, 5 Dec 2016 14:24:01 +0900 (JST) Received: from relmlii2.idc.renesas.com [10.200.68.66] by relmlac3.idc.renesas.com with ESMTP id QAH21089; Mon, 5 Dec 2016 14:24:01 +0900 X-IronPort-AV: E=Sophos;i="5.33,302,1477926000"; d="scan'208";a="227740722" Received: from mail-hk2apc01lp0207.outbound.protection.outlook.com (HELO APC01-HK2-obe.outbound.protection.outlook.com) ([65.55.88.207]) by relmlii2.idc.renesas.com with ESMTP/TLS/AES256-SHA256; 05 Dec 2016 14:24:00 +0900 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=renesasgroup.onmicrosoft.com; s=selector1-renesas-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=6bKggv+ej3yFNz8mXrVTxtbnCHCvr93EMHv1n4/H35E=; b=mXMW0my+8VfemY5rp5l/eY4wg44vp8A7rbH8pq+9zqPl8HwIm8ScwLKdeT0aHhC544deVTB+tP51/szArJ6EXEhexdPT2QWAXaxPJ/in27fpwEYqiE2lMr7eaIQFnQc5DE4Y9S+gO7ySiuIBbCN5rQTejr68dK6BBbKpEREh8zc= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=kuninori.morimoto.gx@renesas.com; Received: from morimoto-PC.renesas.com (211.11.155.144) by HK2PR0601MB1442.apcprd06.prod.outlook.com (10.165.182.148) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.747.13; Mon, 5 Dec 2016 05:23:56 +0000 Message-ID: <87zikbuezr.wl%kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH 3/3] ASoC: simple-card-utils: enable clocks/clock-names/clock-ranges User-Agent: Wanderlust/2.15.9 Emacs/24.3 Mule/6.0 To: Russell King - ARM Linux , Stephen Boyd , Rob Herring , Linux-ALSA , Linux-DT , Michael Turquette , Linux-Kernel , Mark Brown , , Linux-ARM In-Reply-To: <874m2jvtmw.wl%kuninori.morimoto.gx@renesas.com> References: <874m2jvtmw.wl%kuninori.morimoto.gx@renesas.com> MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Date: Mon, 5 Dec 2016 05:23:56 +0000 X-Originating-IP: [211.11.155.144] X-ClientProxiedBy: OSXPR01CA0004.jpnprd01.prod.outlook.com (10.167.143.157) To HK2PR0601MB1442.apcprd06.prod.outlook.com (10.165.182.148) X-MS-Office365-Filtering-Correlation-Id: 8b015ae0-9f3d-4969-5d4a-08d41ccee9b1 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:HK2PR0601MB1442; X-Microsoft-Exchange-Diagnostics: 1; HK2PR0601MB1442; 3:OtOvoxxvB6WqhFz4e8IywWer8HgoontmCh78stNha/sXMA0klfFDfUVKPQPl7ySLVVYG0XefSwD+egpz/0CIwHN/R9sj/Dg2Yn4E3chdlKIysaVKKf+hPQNTm4PYtwpZPwWIhXQn9ROxotSxUBNLzN84hZHsxm3wn03SSojIoE1CRfBhu5tnsxALZUpZXFwMUOE18NooL2Qq8xtDU1wy5fYTfvgaNWzbwe8dXkkEhmSOSaEL9yMCg3Q3v3qwKV7+evMtzjRnLZq0fXzQ/RPskA== X-Microsoft-Exchange-Diagnostics: 1; HK2PR0601MB1442; 25:Ht/QyHL/4RITJrWMfhMPu4LPcbxcmO/VNlK9pleWMdfeIpbW2ElTWr/2zCPssmf773k0ont1CI5z/ykStsK6Ef11PjsGGN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Ey4i8vW0G6cMWk8Bt04nmi+cTKlA5uiUInOziPkXU4nEBuTT+iu91eXqgRgbT/LklJRZvnGxiOm8eAZBNI/HdAMhlTo+bExhxw3+HYOgN9zJr0PoVFK4ATktw97GKTckT+UbPH6dUnvQEeOrkVkjD2KQwTN8H7ejIuHeGBynBvP6d5hfM5gv/Rc13Rd3IR8wfpYBunG00R1TwQakQsFIHEsLOVA6xnoCwm9opNaq8WUwze43IUZPNVOjNDK/vMN5LbtsB6mpXFLgTAF1TF5AGJJY5GXE5jSr9cPFmZmDY4siL2+9Di5G8GnFq9FfUN6dMLoOGNbI4J620MGMRTkGXHMixwBB673qbhmIPbB9d41BUIdRz8MaMXySrNBSug1bVdkgyTvrK8RY1Y3kmH1DZ X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046)(6055026)(6041248)(20161123560025)(20161123564025)(20161123562025)(20161123555025)(20161123558021)(6072148); SRVR:HK2PR0601MB1442; BCL:0; PCL:0; RULEID:; SRVR:HK2PR0601MB1442; X-Microsoft-Exchange-Diagnostics: 1; HK2PR0601MB1442; 4:tYw4qCWPdajqGIPrWqIVbUhQjnwzkNXPtVPcS96A9pye/rsDyeDbvjxXitkpTRvXGMQKa65fSHwcXTP2cJEOzEQCObJD4M1bTXIt7KsN0wOb40aR6twaxINw3RwPCsTKduWHMPN+BtvwfbRMGkSNoECW6a5l3bm6VS59DFDShZAXDunqnVNJoKDpiY4wm7pEjchSo0/wpuUDR41NaK4HpODwVhURuM09qFNWuNtoZYUztsemiwOpP5I7+bW3OPLRG18QDetiZTlIWWROiQyg5f8DY3P8a5CeSWToLn2ligKPMqG3fOvMyOfLScqg4fafYwOdgqhAxCiw89MwzU6DVZFTmF5M1PEsqnOnJXnq04NXoCaZ0pAR3vzzwluICfM2TN+6zY9LrTs8XAYgu8fy1NPql0B26KXoau4RXppKgpXnH/SbbgqRQctnDJgu0eIyA4VBpl0n3vrap8WXOCMAuuNz8dmTXPhGIi0LCatliNlCHtwAHtxHM9HHHZHrE5RA+y3bnZMZizonCeH3OL5XmZWf3LZ2HwJGl5oGJzrIQ3eXOmy0BRw9YlXrbSOUhg6Red9r3M7Mue3i7Q+MmFBzO4asZmISmJJXP2sii8nvC4gQSQGBpTf3tznQGvCQgicq X-Forefront-PRVS: 0147E151B5 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(4630300001)(6009001)(7916002)(199003)(189002)(68736007)(8676002)(46406003)(38730400001)(305945005)(81166006)(81156014)(36756003)(7736002)(230783001)(7846002)(101416001)(2950100002)(7416002)(39410400001)(5660300001)(33646002)(50986999)(39850400001)(76176999)(54356999)(69596002)(4001350100001)(50466002)(97736004)(5001770100001)(23726003)(106356001)(83506001)(105586002)(2906002)(6116002)(3846002)(92566002)(107886002)(47776003)(39450400002)(6486002)(189998001)(86362001)(66066001)(733004)(53416004)(42186005)(39840400001)(39860400001)(21314002)(921003)(1121003)(16060500001); DIR:OUT; SFP:1102; SCL:1; SRVR:HK2PR0601MB1442; H:morimoto-PC.renesas.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: renesas.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; HK2PR0601MB1442; 23:ZtHnDbkKJzpXnWQ4wAmE/eZ1Azk3J+HLUvj3PwB?= =?us-ascii?Q?LMP9lMxrHijIeTzmJZsR3ykvgyxes3bjlvUnkzZdq0BweBpBQmEYU9TEBa3q?= =?us-ascii?Q?ZqXkaga7jt8+sFDbFkLVM/cKY91BWLf7ZLoAaYg6Q4UQ8ngYZt8ScO8P0STQ?= =?us-ascii?Q?TY5km3WLNgulOHq7Aax7g8jzh8IJJ92V4jjECSF8B9cyF3UTq+rS+NLF0KFz?= =?us-ascii?Q?ff3j1jNrKtV3h3FldHczvmFy4mvE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99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; HK2PR0601MB1442; 7:3oRBglayindVKI1E1PrrS4a6OjQACs8q2/zgAy0NBRGq8aPDhmmTZpVPBJT+vMWIYcqTqpQB/oW2FI7L9a13f2OI/6IKhiN8J0/Be6Oj4y9rm3xF5QVay7kDYfuHiEF1lwJhzLFS3PiErxf2iDxoOv1UPICQ37HxFxfbgH1WeQQB1EcrL8Kva/Fug3w1g1iPdA+Kg3DDiCUpEF1TCyp/1ZUHILN6Y33kXdl9INQ68QOkNgGyfuCPX/Ou/ipfam0seuFHvivOQ4kQu8k1mT4lnkMpsCDNe8TngviwfNMqI5QQ14S2h9HP55hP4lFec2QZQXtnB3IdKzjlk/d5ARsU5HQRnpGxD02ETjBh/LOGC94es9BGqlPpcOEl88EE2kzxpYZoDRcMdOek+l+r+0CwmBviKSuC4TdcyM6biy2M6fKj80I0l8HmVghXKKomcpMJiLEK9Hd2twkJ2ei4AkEdSA==; 20:YOqUDwZuKlJVZI6cUh41Vm7BdwvSG09d054ct8hiYoD8ZZK3vaMBmA2Qb3vu7eLaPRVLRn82LUlf+lIqdjaq8FTJlc9H1z1IJTh91jo0DJmdkKFMGbDf0yNywJKu2NNAyVXByaCl0TrHWLd/LdiGaaQ0kt3cf76WNn4V3emYP4A= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Dec 2016 05:23:56.5960 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: HK2PR0601MB1442 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20161204_212424_484917_613B6D2F X-CRM114-Status: GOOD ( 14.46 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Kuninori Morimoto Current simple-card is supporting this style for clocks sound { ... simple-audio-card,cpu { sound-dai = <&xxx>; clocks = <&cpu_clock>; }; simple-audio-card,codec { sound-dai = <&xxx>; clocks = <&codec_clock>; }; }; Now, it can support this style too, because we can use devm_get_clk_from_child() now. sound { ... clocks = <&cpu_clock>, <&codec_clock>; clock-names = "cpu", "codec"; clock-ranges; ... simple-audio-card,cpu { sound-dai = <&xxx>; }; simple-audio-card,codec { sound-dai = <&xxx>; }; }; Signed-off-by: Kuninori Morimoto --- .../devicetree/bindings/sound/simple-card.txt | 32 ++++++++++++++++++ sound/soc/generic/simple-card-utils.c | 39 +++++++++++++++++++++- 2 files changed, 70 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/sound/simple-card.txt b/Documentation/devicetree/bindings/sound/simple-card.txt index c7a9393..43a710b 100644 --- a/Documentation/devicetree/bindings/sound/simple-card.txt +++ b/Documentation/devicetree/bindings/sound/simple-card.txt @@ -86,6 +86,7 @@ Optional CPU/CODEC subnodes properties: in dai startup() and disabled with clk_disable_unprepare() in dai shutdown(). + see Clock Example. Example 1 - single DAI link: @@ -199,3 +200,34 @@ sound { clocks = ... }; }; + + +Clock Example 1 - clock settings on each subnode + +sound { + ... + simple-audio-card,cpu { + sound-dai = <&xxx>; + clocks = <&cpu_clock>; + }; + simple-audio-card,codec { + sound-dai = <&xxx>; + clocks = <&codec_clock>; + }; +}; + +Clock Example 2 - clock settings by clocks + +sound { + ... + clocks = <&cpu_clock>, <&codec_clock>; + clock-names = "cpu", "codec"; + clock-ranges; + ... + simple-audio-card,cpu { + sound-dai = <&xxx>; + }; + simple-audio-card,codec { + sound-dai = <&xxx>; + }; +}; diff --git a/sound/soc/generic/simple-card-utils.c b/sound/soc/generic/simple-card-utils.c index 4924575..c3031a5 100644 --- a/sound/soc/generic/simple-card-utils.c +++ b/sound/soc/generic/simple-card-utils.c @@ -104,15 +104,52 @@ int asoc_simple_card_parse_clk(struct device *dev, struct asoc_simple_dai *simple_dai) { struct clk *clk; + const char *con_id = NULL; + const char *port_name[] = { + "cpu", "codec" + }; u32 val; /* + * We can use this style if "con_id" is not NULL + * + * sound { + * ... + * clocks = <&xxx>, <&xxx>; + * clock-names = "cpu", "codec"; + * clock-ranges; + * + * simple-audio-card,cpu { + * sound-dai = <&xxx>; + * }; + * simple-audio-card,codec { + * sound-dai = <&xxx>; + * }; + * }; + */ + if (of_find_property(dev->of_node, "clock-names", NULL)) { + int i; + int port_len, node_len; + + for (i = 0; i < ARRAY_SIZE(port_name); i++) { + node_len = strlen(node->name); + port_len = strlen(port_name[i]); + + if (0 == strncmp(node->name + node_len - port_len, + port_name[i], port_len)) { + con_id = port_name[i]; + break; + } + } + } + + /* * Parse dai->sysclk come from "clocks = <&xxx>" * (if system has common clock) * or "system-clock-frequency = " * or device's module clock. */ - clk = devm_get_clk_from_child(dev, node, NULL); + clk = devm_get_clk_from_child(dev, node, con_id); if (!IS_ERR(clk)) { simple_dai->sysclk = clk_get_rate(clk); } else if (!of_property_read_u32(node, "system-clock-frequency", &val)) {