From patchwork Thu Jan 21 01:58:33 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 8076701 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 19F98BEEE5 for ; Thu, 21 Jan 2016 02:04:12 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 10E4B205E7 for ; Thu, 21 Jan 2016 02:04:11 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 88AC4205DA for ; Thu, 21 Jan 2016 02:04:09 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id A21D126602C; Thu, 21 Jan 2016 03:04:08 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Status: No, score=-1.9 required=5.0 tests=BAD_ENC_HEADER,BAYES_00, RCVD_IN_DNSWL_NONE, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id F305C261586; Thu, 21 Jan 2016 03:00:58 +0100 (CET) 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 88C27261586; Thu, 21 Jan 2016 03:00:57 +0100 (CET) Received: from relmlie1.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by alsa0.perex.cz (Postfix) with ESMTP id 33F38265DB0 for ; Thu, 21 Jan 2016 02:58:37 +0100 (CET) Received: from unknown (HELO relmlir1.idc.renesas.com) ([10.200.68.151]) by relmlie1.idc.renesas.com with ESMTP; 21 Jan 2016 10:58:36 +0900 Received: from relmlac1.idc.renesas.com (relmlac1.idc.renesas.com [10.200.69.21]) by relmlir1.idc.renesas.com (Postfix) with ESMTP id CC23D504D1; Thu, 21 Jan 2016 10:58:36 +0900 (JST) Received: by relmlac1.idc.renesas.com (Postfix, from userid 0) id A9CA38002D; Thu, 21 Jan 2016 10:58:36 +0900 (JST) Received: from relmlac1.idc.renesas.com (localhost [127.0.0.1]) by relmlac1.idc.renesas.com (Postfix) with ESMTP id 902218002E; Thu, 21 Jan 2016 10:58:36 +0900 (JST) Received: from relmlii2.idc.renesas.com [10.200.68.66] by relmlac1.idc.renesas.com with ESMTP id LAG01289; Thu, 21 Jan 2016 10:58:36 +0900 X-IronPort-AV: E=Sophos;i="5.22,323,1449500400"; d="scan'";a="203941282" Received: from mail-hk2apc01lp0209.outbound.protection.outlook.com (HELO APC01-HK2-obe.outbound.protection.outlook.com) ([65.55.88.209]) by relmlii2.idc.renesas.com with ESMTP/TLS/AES256-SHA; 21 Jan 2016 10:58:35 +0900 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 SG2PR06MB1020.apcprd06.prod.outlook.com (10.161.9.28) with Microsoft SMTP Server (TLS) id 15.1.390.13; Thu, 21 Jan 2016 01:58:33 +0000 Message-ID: <87d1sv4rym.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: <87r3hb4s53.wl%kuninori.morimoto.gx@renesas.com> References: <87r3hb4s53.wl%kuninori.morimoto.gx@renesas.com> MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Date: Thu, 21 Jan 2016 01:58:33 +0000 X-Originating-IP: [211.11.155.144] X-ClientProxiedBy: TY1PR0201CA0005.apcprd02.prod.outlook.com (25.164.90.143) To SG2PR06MB1020.apcprd06.prod.outlook.com (25.161.9.28) X-Microsoft-Exchange-Diagnostics: 1; SG2PR06MB1020; 2:ED8DWb3ZZK4uy71AtoZPrC1M5pF51+Au72kCJepy8jBXRrLLEy0bsHSA2wL7RXfvjHlxQxteMv4EXTUDRzOKF3XqNMlKpnipOiaK4uIsRDLP6st6eOEkKRMtj2AiLqHty6zLbb7Xc4k04h5UyhAz2w==; 3:PpCnnC3DDJK9pvnYXcpOgpyUcT7MheZ3EdckAYE4A7imu4LhBEoaLdU6EXl3zKlhZiFSseRwBp22N5oUVSmRhS5TIc2M5Mqq36NoBJgH+Ecsw12sYK1izKhKGuTmqUS7; 25:i71Z8rLeatDX3Spg8bPkyoQKZCeo++2WNA21hXIy8rjNkXfiPzH35YZY1e45prqFsKYqe6yl+vgZwEodAfbFdUYBtqMGP7Rtpe01UOJf+HX84lS1rxOq3cVfA83ggbfbWTpvwvzlWXv+lxBpbaABv8BXwHsXXODYaqs0SMRVVWD2Tn0B5Jk0ANXaLzlZgBuIDrxMFWOqzzZD1b5IP+ZEjc+q7RWXifv64S3wX18tPWtlTrWwsJuS+157prqaRfNn X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:SG2PR06MB1020; X-MS-Office365-Filtering-Correlation-Id: fcb1d846-e722-4fb6-4903-08d322065ecd X-Microsoft-Exchange-Diagnostics: 1; SG2PR06MB1020; 20:wIbjVo3nFtkEGo4bFXnyO3kF8BdRWjd0q34lrD9ia4w6o6CiENbyzYk79byyHTlYSSEk9MYITNsQFItG3yPC9gIPk6V7pmiYU5i4aTgQ/hv2rjPFOrs05VOBjmIE0ZjC0hqTJcOxpadTG/xnmTobPUac6oPsWbYtW+/2ThkdtiY5P1n7hZS92ifv3vaBO3ikSpY4qPjej1Geg/H+M7oNGljimHQjBog8PPuRaTwx/vhWPoZ9dKurTpoao1EJz0aEqzTpQfIPjbQAJneTI/2+mHU+flGjrWVw1YKH9mytGw64+R8lr18uTBBk2KJA0kGrzh+0vP/kCNqhRy2ya2rjmSf/PvxVOOP9KZ5SgTY0IuW8cKX3rNUcdJ4ZlhPuBtE46HVtvMXkTsxxqUl8UqWzFwFq4d1YkVBSFN5t7PVBWtPfoKmtyzfQa03gbCCvVAbdfZBJHpUvHGPb75FjjYVOewP//eIST+wuAzjdkemuwFI2t6QBfA3n6gVW93o+ASrE; 4:TKq1f4tMYo9h7h8rRbD914HKIZH7bZuSVkzd+5caFGtkjAUGU2h9ev0iofrKfqdeM39vBM7+3MPHnEKvvQ9hoelW2EkewEbuEzC3bc/PumFAh3WBDkUZQIb7c6CRF3AugzvU8QTwAnLvMoQnp/zSTG0RV3hIIVXic2PMPC0iRt7XfbqR30aP1uc+GI5R9bfrjCLfrmhqlY3ns1kzpwm1WMn8v6rR056PZHzBkSMoEzrBGgqjw1qeF7sr0Ni1oUbi365PiVKQ6/fKN8zKPxihFPBu7o9VoseUrbc74SMaduCjrzyTDG6JnSsddtXSHmUszP68qphyeomGhsdBjobEhfFRmtaPYS8Oxax/9mvGLEUOWE34PRZm8PGIaRLLz6r/qO+v/QtcQzkY3826l55tTTYxbdm6NtZFPPYgIacKxEQQEB5gCORx6t6YWJT7e0CN X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(85106069007906); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(123027)(601004)(2401047)(5005006)(520078)(8121501046)(3002001)(10201501046); SRVR:SG2PR06MB1020; BCL:0; PCL:0; RULEID:; SRVR:SG2PR06MB1020; X-Forefront-PRVS: 08286A0BE2 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(6009001)(199003)(189002)(5004730100002)(42186005)(76176999)(47776003)(66066001)(33646002)(53416004)(189998001)(86362001)(101416001)(97736004)(87976001)(81156007)(230783001)(4001350100001)(5001960100002)(69596002)(19580405001)(92566002)(83506001)(50986999)(54356999)(19580395003)(110136002)(2950100001)(105586002)(229853001)(5890100001)(6116002)(77096005)(106356001)(122386002)(3846002)(46406003)(23726003)(40100003)(36756003)(50466002)(1096002)(5008740100001)(4326007)(2906002)(586003); DIR:OUT; SFP:1102; SCL:1; SRVR:SG2PR06MB1020; H:morimoto-PC.renesas.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; SG2PR06MB1020; 23:vlRH0brkxKLf+7mt3OOPayi5YgKMx/JonQd1imgjT?= =?us-ascii?Q?qRCNunmUWBAS5S9ehkZPbaTvEwmIM6lwHxftIrZlgWK1l9aYNJjiH1HCbWiB?= =?us-ascii?Q?+OoVzolmq+vHI1cR4x+YPzGTC7rSE1+i6fq0+jeNrDqXT0ziHTAYcHhN7XMn?= =?us-ascii?Q?OSgAcQ/QzuJ4kMeE4YlUvImXpx1MFccaYmrYof3JScSsQT5puh27Df2s6/Lp?= =?us-ascii?Q?fn9NtNz8RMg7QunSZvTvHixn/ySYNxqBNTun9BtW65BRzoWivfc3U+749ut6?= =?us-ascii?Q?Ul2W8iW+Q90ZoyrMK6y+XotZDoDOA6/y3Ql9lAWm8R5uEAUNStgaVm42VlpN?= =?us-ascii?Q?KpGlECXCqd0Mdeu52X6S4T9X5Y5Wuo9sIIOFe00yXBUUVSK3bOS9LfyXmGAm?= =?us-ascii?Q?IkgKJwWmB1SWM5F5CI3jMuhwOUl4hlFlULZYVF0lnD5FM+fp4gUxrpt17Gvl?= =?us-ascii?Q?syaEbNh886bu0iCYvnIMrP6vyjI3FYE0JWFhTEsroXphgSkOeJeYJ1nJ/Zla?= =?us-ascii?Q?Gz/KVBEBvxFpbAyLZQnjYZi/lzhi2pG1kfZ3UHQ31aSn/bVkUUEkD3fbDNj5?= =?us-ascii?Q?f+TaKBsc1cdoCGwHwXVZanA/OsGf/IP5B4hOAYsPe18+ERs3mrelsc+p8+SA?= =?us-ascii?Q?ghvnlM8FkRR7QjGVWhmjMR7McozVzzwxPreUbuQtv+OuthtxIz9Ms9VRkGdI?= =?us-ascii?Q?sQQX9uOgLvSDkydzeWgTBoN+11KV/XjhYMA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pamDiagnosticMetadata: NSPM X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jan 2016 01:58:33.9406 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: SG2PR06MB1020 Cc: Linux-ALSA , Simon , Liam Girdwood Subject: [alsa-devel] [PATCH 10/15] ASoC: rsnd: attach Audio-DMAC-periperi correctly 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 SSI/SRC will try to attach DMAC as Audio-DMAC or Audio-DMAC-periperi. It is fixed IP, but will be attached to each streams as different module in case of MUX (= multi sound path will be merged). This patch solves this issue. Signed-off-by: Kuninori Morimoto --- sound/soc/sh/rcar/dma.c | 56 +++++++++++++++++++++++++----------------------- sound/soc/sh/rcar/rsnd.h | 4 ++-- sound/soc/sh/rcar/src.c | 4 +--- sound/soc/sh/rcar/ssi.c | 5 ++--- 4 files changed, 34 insertions(+), 35 deletions(-) diff --git a/sound/soc/sh/rcar/dma.c b/sound/soc/sh/rcar/dma.c index d1cb3c1..7658e8f 100644 --- a/sound/soc/sh/rcar/dma.c +++ b/sound/soc/sh/rcar/dma.c @@ -622,15 +622,13 @@ static void rsnd_dma_of_path(struct rsnd_mod *this, } } -struct rsnd_mod *rsnd_dma_attach(struct rsnd_dai_stream *io, - struct rsnd_mod *mod, int id) +int rsnd_dma_attach(struct rsnd_dai_stream *io, struct rsnd_mod *mod, + struct rsnd_mod **dma_mod, int id) { - struct rsnd_mod *dma_mod; struct rsnd_mod *mod_from = NULL; struct rsnd_mod *mod_to = NULL; struct rsnd_priv *priv = rsnd_io_to_priv(io); struct rsnd_dma_ctrl *dmac = rsnd_priv_to_dmac(priv); - struct rsnd_dma *dma; struct device *dev = rsnd_priv_to_dev(priv); struct rsnd_mod_ops *ops; enum rsnd_mod_type type; @@ -646,17 +644,10 @@ struct rsnd_mod *rsnd_dma_attach(struct rsnd_dai_stream *io, * rsnd_rdai_continuance_probe() */ if (!dmac) - return ERR_PTR(-EAGAIN); - - dma = devm_kzalloc(dev, sizeof(*dma), GFP_KERNEL); - if (!dma) - return ERR_PTR(-ENOMEM); + return -EAGAIN; rsnd_dma_of_path(mod, io, is_play, &mod_from, &mod_to); - dma->src_addr = rsnd_dma_addr(io, mod_from, is_play, 1); - dma->dst_addr = rsnd_dma_addr(io, mod_to, is_play, 0); - /* for Gen2 */ if (mod_from && mod_to) { ops = &rsnd_dmapp_ops; @@ -678,27 +669,38 @@ struct rsnd_mod *rsnd_dma_attach(struct rsnd_dai_stream *io, type = RSND_MOD_AUDMA; } - dma_mod = rsnd_mod_get(dma); + if (!(*dma_mod)) { + struct rsnd_dma *dma; - ret = rsnd_mod_init(priv, dma_mod, - ops, NULL, rsnd_mod_get_status, type, dma_id); - if (ret < 0) - return ERR_PTR(ret); + dma = devm_kzalloc(dev, sizeof(*dma), GFP_KERNEL); + if (!dma) + return -ENOMEM; - dev_dbg(dev, "%s[%d] %s[%d] -> %s[%d]\n", - rsnd_mod_name(dma_mod), rsnd_mod_id(dma_mod), - rsnd_mod_name(mod_from), rsnd_mod_id(mod_from), - rsnd_mod_name(mod_to), rsnd_mod_id(mod_to)); + *dma_mod = rsnd_mod_get(dma); - ret = attach(io, dma, id, mod_from, mod_to); - if (ret < 0) - return ERR_PTR(ret); + dma->src_addr = rsnd_dma_addr(io, mod_from, is_play, 1); + dma->dst_addr = rsnd_dma_addr(io, mod_to, is_play, 0); + + ret = rsnd_mod_init(priv, *dma_mod, ops, NULL, + rsnd_mod_get_status, type, dma_id); + if (ret < 0) + return ret; - ret = rsnd_dai_connect(dma_mod, io, type); + dev_dbg(dev, "%s[%d] %s[%d] -> %s[%d]\n", + rsnd_mod_name(*dma_mod), rsnd_mod_id(*dma_mod), + rsnd_mod_name(mod_from), rsnd_mod_id(mod_from), + rsnd_mod_name(mod_to), rsnd_mod_id(mod_to)); + + ret = attach(io, dma, id, mod_from, mod_to); + if (ret < 0) + return ret; + } + + ret = rsnd_dai_connect(*dma_mod, io, type); if (ret < 0) - return ERR_PTR(ret); + return ret; - return rsnd_mod_get(dma); + return 0; } int rsnd_dma_probe(struct rsnd_priv *priv) diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h index 2860260..90c732e 100644 --- a/sound/soc/sh/rcar/rsnd.h +++ b/sound/soc/sh/rcar/rsnd.h @@ -166,8 +166,8 @@ u32 rsnd_get_dalign(struct rsnd_mod *mod, struct rsnd_dai_stream *io); /* * R-Car DMA */ -struct rsnd_mod *rsnd_dma_attach(struct rsnd_dai_stream *io, - struct rsnd_mod *mod, int id); +int rsnd_dma_attach(struct rsnd_dai_stream *io, + struct rsnd_mod *mod, struct rsnd_mod **dma_mod, int id); int rsnd_dma_probe(struct rsnd_priv *priv); struct dma_chan *rsnd_dma_request_channel(struct device_node *of_node, struct rsnd_mod *mod, char *name); diff --git a/sound/soc/sh/rcar/src.c b/sound/soc/sh/rcar/src.c index 69ef865..d211ccf 100644 --- a/sound/soc/sh/rcar/src.c +++ b/sound/soc/sh/rcar/src.c @@ -495,9 +495,7 @@ static int rsnd_src_probe_(struct rsnd_mod *mod, return ret; } - src->dma = rsnd_dma_attach(io, mod, 0); - if (IS_ERR(src->dma)) - return PTR_ERR(src->dma); + ret = rsnd_dma_attach(io, mod, &src->dma, 0); return ret; } diff --git a/sound/soc/sh/rcar/ssi.c b/sound/soc/sh/rcar/ssi.c index e68f3a1..9067413 100644 --- a/sound/soc/sh/rcar/ssi.c +++ b/sound/soc/sh/rcar/ssi.c @@ -704,9 +704,8 @@ static int rsnd_ssi_dma_probe(struct rsnd_mod *mod, if (ret) return ret; - ssi->dma = rsnd_dma_attach(io, mod, dma_id); - if (IS_ERR(ssi->dma)) - return PTR_ERR(ssi->dma); + /* SSI probe might be called many times in MUX multi path */ + ret = rsnd_dma_attach(io, mod, &ssi->dma, dma_id); return ret; }