From patchwork Mon Jun 15 06:22:30 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 6606291 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id A7E85C0020 for ; Mon, 15 Jun 2015 06:24:27 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BE1A020570 for ; Mon, 15 Jun 2015 06:24:26 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 87DA520462 for ; Mon, 15 Jun 2015 06:24:25 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 69278261584; Mon, 15 Jun 2015 08:24:24 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 27A6526069D; Mon, 15 Jun 2015 08:23:19 +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 87F9026069E; Mon, 15 Jun 2015 08:23:18 +0200 (CEST) Received: from relmlie1.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by alsa0.perex.cz (Postfix) with ESMTP id 1D431261483 for ; Mon, 15 Jun 2015 08:22:33 +0200 (CEST) Received: from unknown (HELO relmlir2.idc.renesas.com) ([10.200.68.152]) by relmlie1.idc.renesas.com with ESMTP; 15 Jun 2015 15:22:32 +0900 Received: from relmlac3.idc.renesas.com (relmlac3.idc.renesas.com [10.200.69.23]) by relmlir2.idc.renesas.com (Postfix) with ESMTP id 97CAE4532E; Mon, 15 Jun 2015 15:22:32 +0900 (JST) Received: by relmlac3.idc.renesas.com (Postfix, from userid 0) id 8E7721806F; Mon, 15 Jun 2015 15:22:32 +0900 (JST) Received: from relmlac3.idc.renesas.com (localhost [127.0.0.1]) by relmlac3.idc.renesas.com (Postfix) with ESMTP id 87BF61800A; Mon, 15 Jun 2015 15:22:32 +0900 (JST) Received: from relmlii2.idc.renesas.com [10.200.68.66] by relmlac3.idc.renesas.com with ESMTP id RAX17513; Mon, 15 Jun 2015 15:22:32 +0900 X-IronPort-AV: E=Sophos;i="5.13,616,1427727600"; d="scan'";a="189472403" Received: from mail-hk1lp0122.outbound.protection.outlook.com (HELO APAC01-HK1-obe.outbound.protection.outlook.com) ([207.46.51.122]) by relmlii2.idc.renesas.com with ESMTP/TLS/AES256-SHA; 15 Jun 2015 15:22:31 +0900 Authentication-Results: kernel.org; dkim=none (message not signed) header.d=none; Received: from morimoto-PC.renesas.com (211.11.155.132) by SIXPR06MB317.apcprd06.prod.outlook.com (10.141.125.143) with Microsoft SMTP Server (TLS) id 15.1.190.14; Mon, 15 Jun 2015 06:22:30 +0000 Message-ID: <87mw01v6g7.wl%kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto User-Agent: Wanderlust/2.15.9 Emacs/24.3 Mule/6.0 To: Mark Brown In-Reply-To: <87twu9v6kn.wl%kuninori.morimoto.gx@renesas.com> References: <87twu9v6kn.wl%kuninori.morimoto.gx@renesas.com> MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Date: Mon, 15 Jun 2015 06:22:30 +0000 X-Originating-IP: [211.11.155.132] X-ClientProxiedBy: OS1PR01CA0043.jpnprd01.prod.outlook.com (25.164.162.27) To SIXPR06MB317.apcprd06.prod.outlook.com (10.141.125.143) X-Microsoft-Exchange-Diagnostics: 1; SIXPR06MB317; 2:furAvR1NX8JiKlWF+BVImDRD0qEpXgl+2rW+nB5GogrS798fCLwpZz6t5y4cDRSA; 2:gwErV3C+ZxKnMNvtQCmM4izy70eHWPxCCr+ShYR5QBybnOvP8Ea9+YcGbunQYZloltCbCqRAe49hq+MDfTJ1ECV2B9z7Obs/umHJ9g+LWIAYEIIPbJwAHCmrQ71TWcgshd/AGCLFULP5zkB/laspjA==; 6:j9JRv2jbFtA8GGWq9sUrCSYason1yyj0O+t3bj8AGGC5VLA0t9kblTTTeKPh59EWORnm6dwH+xMLBoVcdvN3GcMpthJC/HpHWo/mEtn/s3gCKP8h7A14hoAXySIdKccZS8RTTk0It5e5kqGgLTnBdY6a2CkfD0Ia9pagszwMbLrUxWF1SVg1A28WJPCpCHxGsWQdMXdrsjksTDU4ot0/rA8Q2GcpjLMGnuev7i8+wkW8bar1FRBJKdSXYc+vFZWnj04sdoQZ/iXDGD4giQyj6fhFM72w0pOIsB7/Wy2JgMng0SqbNJ7tkIenhcFusJ0Y2Hxj+ZPIJk+X4NahuO7VPK1lkyL1Hs0GX8sp1aE/3joorPiZ+4gkgAeUTIa6GIzBtdbV9NQg5v1aFzp1WgZwKYIwZ5RuJnkEcWU8S74HjS27ezGTedhi6l1/7Bfav1vUF8l/r7yLdpl8InfHihP6z9YsVR7XkLUNelxOpbX+nIJF/B6Zz5EgEoKO4y+9WqCc X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:SIXPR06MB317; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(5005006)(520003)(3002001); SRVR:SIXPR06MB317; BCL:0; PCL:0; RULEID:; SRVR:SIXPR06MB317; X-Microsoft-Exchange-Diagnostics: 1; SIXPR06MB317; 3:AFf1cHy9GmAW7R9htUJOpVmFdZ4cKv1sXivVHJJnT5/ZnEgJjMr1jhIhh7X7/4Uy+6N6QJUPI0rKRuLpvE82Btklo++S+MIY7KL36GnGOkhxkgvhr5mlsdqBlv8+BJjW5O6ym+Ra0/PAg07geUa3c8QFSn0UE8j4sEe2f99BlvzU642kIsQAxlF0mlY4eeNporcoT2Z68mqyqBSYVnIhGhCKIKSJS75XYul2/aRD1QghWKkYh0xdHCHAvKESzkD1RXeCOF+LJ44k2Gusp+05ct00QP0WnwSaaeagihC9kFQ6BaPsZ+p51Ft6giABR9fz X-Forefront-PRVS: 0608DEDB67 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(6009001)(50986999)(54356999)(76176999)(110136002)(2950100001)(77096005)(46102003)(33646002)(19580405001)(23726002)(66066001)(47776003)(229853001)(36756003)(86362001)(19580395003)(83506001)(87976001)(50466002)(122386002)(40100003)(4001350100001)(5001960100002)(92566002)(77156002)(189998001)(62966003)(53416004)(42186005); DIR:OUT; SFP:1102; SCL:1; SRVR:SIXPR06MB317; H:morimoto-PC.renesas.com; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; SIXPR06MB317; 9:X/sE8h1sA01KZ/2lrS178T8KEmO68awtrTyyV5lOpKDawIOoNPUWWg7rsKIYKqmDWI2lcXCtmWpZyLOBIODKmJy9z8JbJmrW3xWJ5uC7Q4EH3M9TeHvvNZal7FkNNqBZT8TuRNy6dFJ+GgfH4r1khZDUOxcSIFDiSKChbJxY3rdqGCi+ozo2FcGKFmx1YWs2B8QVWc8WUZELDf4+HxDZ74cv366yRmrbiKGeWjI9eokN1o/a/Qic8lnEvlXoXxtDyaWXM6j1qqtBF/S19jEa/Uz+VzgbOHjqcYDMjHEJbuVuIdW7WgJx+OpsAvoRm0mBwysJgDClIUf0/ZrwZo3L9nTi172mKEN+8sEp0nlevbNkJMgxTVOI0OxBVrfcWkjPhnvevoJLP24NP+/tj022j91/gA9rPvSCJaFLb6BjFxW7Ul2P4m5V0iQQoysTwvd+PRUZNTGWQDiQx8Qnl7J4SzqM0ctKz7as7oQUjppqJUYwT8NksloEw44c+yoz4OGn82mmNgsLZDa2i8WMZdDwnxq+EZVUknQHlSsqW/6DMG8dYkluh6iKd4QV/d3rRVM1G1FqtFlVdgk+kGKKS28D5tLvh/YA5hPqhMfbIb7ljY8BYb4mApZCyaT37TNoJqz4JBA4M9rn0mIE9Z8k649x6WCAvwPsFQ6zF88RPpd+QAcQdewrWHRs0JS+Dvzqe0UEUNz5VCnB5ORknfjhM6z3Lio7UPsmRKt/kXR/wAn4Fe/7MOTWb7aX7AjeifohuSTALS/lY7tU4YoYyf8vDxvgPovGwGiWmyOE9BsWJtHOcyC+8GYvFhBJ5z4NOcWIcm5iIMNo80lOb+Lkx8fvTKmH6w== X-Microsoft-Exchange-Diagnostics: 1; SIXPR06MB317; 3:C7aq2chuUSzOp+QaKlomLHbuVMVpL5DFZ0MbUV6GUQY6Ujm2kls5FbYa01TwuLuZC9ZtYLM+XQR48qYwA9umbzWXYLWEwtIfXSLknQLTbK03eju1d2t97RXuIA8NkDl8dus4gLy1XEyI/iVUvAY/DQ==; 10:GEFQ4h8AyHI8FwhWvgEp8cJyfae1t0NkubX8yAc/V3UdjB3cWYS1ow1e91mpkqSr0V92MAcJHi7huErvO9o1q9W2IcBWpjDM1vRKVc06MJg=; 6:7EU8FfMkzIgBitUURh2ba5ZmEJFePBHKuyLfZaftnX/iVFQixcwXJogYlyU17PH7xySKJMNm44hbeIo8RA76uSvOTaGDRyXTHb/ocbk5FPbmdvHiKeXxR9Awrtg+mym6Uff1OGFHQvNwHzq+xqTv8Q== X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jun 2015 06:22:30.1096 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: SIXPR06MB317 Cc: Linux-ALSA , Simon , Liam Girdwood Subject: [alsa-devel] [PATCH 05/21] ASoC: rsrc-card: enable multi cpu/codec for DPCM 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP From: Kuninori Morimoto Current rsrc-card is assuming 1 FE (= CPU), 1 BE (= codec) on card. But, it will support multi FE/BE card. This is prepare for it. Signed-off-by: Kuninori Morimoto Tested-by: Keita Kobayashi --- sound/soc/sh/rcar/rsrc-card.c | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/sound/soc/sh/rcar/rsrc-card.c b/sound/soc/sh/rcar/rsrc-card.c index cdd005b..ae99b36 100644 --- a/sound/soc/sh/rcar/rsrc-card.c +++ b/sound/soc/sh/rcar/rsrc-card.c @@ -52,7 +52,6 @@ struct rsrc_card_dai { struct clk *clk; }; -#define RSRC_FB_NUM 2 /* FE/BE */ #define IDX_CPU 0 #define IDX_CODEC 1 #define DAI_NAME_NUM 32 @@ -62,9 +61,10 @@ struct rsrc_card_priv { struct rsrc_card_dai cpu_dai; struct rsrc_card_dai codec_dai; char dai_name[DAI_NAME_NUM]; - } dai_props[RSRC_FB_NUM]; + } *dai_props; struct snd_soc_codec_conf codec_conf; - struct snd_soc_dai_link dai_link[RSRC_FB_NUM]; + struct snd_soc_dai_link *dai_link; + int dai_num; u32 convert_rate; }; @@ -395,12 +395,25 @@ static int rsrc_card_parse_of(struct device_node *node, struct device *dev) { const struct rsrc_card_of_data *of_data = rsrc_dev_to_of_data(dev); + struct rsrc_card_dai_props *props; + struct snd_soc_dai_link *links; + int ret; - int i; + int i, num; if (!node) return -EINVAL; + num = of_get_child_count(node); + props = devm_kzalloc(dev, sizeof(*props) * num, GFP_KERNEL); + links = devm_kzalloc(dev, sizeof(*links) * num, GFP_KERNEL); + if (!props || !links) + return -ENOMEM; + + priv->dai_props = props; + priv->dai_link = links; + priv->dai_num = num; + /* Parse the card name from DT */ snd_soc_of_parse_card_name(&priv->snd_card, "card-name"); @@ -408,7 +421,7 @@ static int rsrc_card_parse_of(struct device_node *node, priv->snd_card.owner = THIS_MODULE; priv->snd_card.dev = dev; priv->snd_card.dai_link = priv->dai_link; - priv->snd_card.num_links = RSRC_FB_NUM; + priv->snd_card.num_links = num; priv->snd_card.codec_conf = &priv->codec_conf; priv->snd_card.num_configs = 1; priv->snd_card.of_dapm_routes = of_data->routes; @@ -422,7 +435,7 @@ static int rsrc_card_parse_of(struct device_node *node, priv->convert_rate); /* FE/BE */ - for (i = 0; i < RSRC_FB_NUM; i++) { + for (i = 0; i < num; i++) { ret = rsrc_card_dai_link_of(node, priv, i); if (ret < 0) return ret;