From patchwork Wed Jul 15 07:16:56 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 6794271 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 4344C9F380 for ; Wed, 15 Jul 2015 07:49:57 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 48FF3205CB for ; Wed, 15 Jul 2015 07:49:56 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id C6D712052A for ; Wed, 15 Jul 2015 07:49:54 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 6D324265FC8; Wed, 15 Jul 2015 09:38:01 +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 A77F6265A78; Wed, 15 Jul 2015 09:30:42 +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 BA667265900; Wed, 15 Jul 2015 09:30:40 +0200 (CEST) Received: from relmlie1.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by alsa0.perex.cz (Postfix) with ESMTP id 06307265DAB for ; Wed, 15 Jul 2015 09:23:00 +0200 (CEST) Received: from unknown (HELO relmlir1.idc.renesas.com) ([10.200.68.151]) by relmlie1.idc.renesas.com with ESMTP; 15 Jul 2015 16:16:59 +0900 Received: from relmlac4.idc.renesas.com (relmlac4.idc.renesas.com [10.200.69.24]) by relmlir1.idc.renesas.com (Postfix) with ESMTP id 2218E46728; Wed, 15 Jul 2015 16:16:59 +0900 (JST) Received: by relmlac4.idc.renesas.com (Postfix, from userid 0) id 1E301480A4; Wed, 15 Jul 2015 16:16:59 +0900 (JST) Received: from relmlac4.idc.renesas.com (localhost [127.0.0.1]) by relmlac4.idc.renesas.com (Postfix) with ESMTP id 176FF480A3; Wed, 15 Jul 2015 16:16:59 +0900 (JST) Received: from relmlii1.idc.renesas.com [10.200.68.65] by relmlac4.idc.renesas.com with ESMTP id SAB15174; Wed, 15 Jul 2015 16:16:58 +0900 X-IronPort-AV: E=Sophos;i="5.15,477,1432566000"; d="scan'";a="190395390" Received: from mail-sg2apc01lp0242.outbound.protection.outlook.com (HELO APC01-SG2-obe.outbound.protection.outlook.com) ([65.55.88.242]) by relmlii1.idc.renesas.com with ESMTP/TLS/AES256-SHA; 15 Jul 2015 16:16:58 +0900 Authentication-Results: kernel.org; dkim=none (message not signed) header.d=none; Received: from morimoto-PC.renesas.com (211.11.155.144) by HK2PR06MB0594.apcprd06.prod.outlook.com (10.161.187.145) with Microsoft SMTP Server (TLS) id 15.1.213.14; Wed, 15 Jul 2015 07:16:56 +0000 Message-ID: <877fq1vqo7.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: <87d1ztx5pb.wl%kuninori.morimoto.gx@renesas.com> References: <87d1ztx5pb.wl%kuninori.morimoto.gx@renesas.com> MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Date: Wed, 15 Jul 2015 07:16:56 +0000 X-Originating-IP: [211.11.155.144] X-ClientProxiedBy: TY1PR01CA0026.jpnprd01.prod.outlook.com (25.164.162.136) To HK2PR06MB0594.apcprd06.prod.outlook.com (25.161.187.145) X-Microsoft-Exchange-Diagnostics: 1; HK2PR06MB0594; 2:6tHh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B5UV1dlMei8lLki; 4:Txdajf6xOferCHjPFeY9Te4L7u557bTgVJ4OS0lZhMOdNMiGhZXw0p9d5GbAKFKfjugsQCKrLpejSQeGUb/UW/ZR5mRRzMAxxkPDlhHbFlA4Yp7mwfeDSZm4CVztqhYsnuAaHcAvEx+C11HJIYnqKwjw4JlOCKHmT+k1dbsmPntT/AEaVVANu0Y5VbClWgpuU3w7jSL/S+JCbvD/KH8pF7oFpEtg3C8zkTxeeqZTCE47Nn7Qjoz2nciOgaJ3G0ruLs1Wnm2U1Zn1erzD90e4a7Bt1QoJnKyiVDpJFgJ6mQg= HK2PR06MB0594: X-MS-Exchange-Organization-RulesExecuted X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(5005006)(3002001); SRVR:HK2PR06MB0594; BCL:0; PCL:0; RULEID:; SRVR:HK2PR06MB0594; X-Forefront-PRVS: 0638FD5066 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(6009001)(76176999)(46406003)(23726002)(54356999)(77096005)(46102003)(86362001)(50986999)(107886002)(110136002)(83506001)(189998001)(66066001)(122386002)(33646002)(36756003)(62966003)(77156002)(229853001)(47776003)(40100003)(19580395003)(92566002)(19580405001)(5001960100002)(4001350100001)(87976001)(50466002)(42186005)(53416004)(2950100001)(4001430100001)(309714004); DIR:OUT; SFP:1102; SCL:1; SRVR:HK2PR06MB0594; H:morimoto-PC.renesas.com; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; HK2PR06MB0594; 23:8ofx6zhrx5NhxubwsD8/6D/W/+n/FK88HOYzdkskPEvpK7TdmscNlDz+1eKVPJG9o3LkhUzh8GMLI+DsDf0F30xTl8VErt9ZLGl24p0MDF793zFFy+foNjOHXrESWjppcnhBV/hWCmeCCWf58utxB/bN3I+rv0bXOj0W4oXwIw0mYigQO/TaVyzE3zHc735/mcJT921AyVsuyZ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PqQtIcM7n8SoE0DKkBtflUSj0xGperliWZuYFpsmGfUzzl0q3A8WV6j5TT3H4BGxZ18KmVo1IVruUvKD3tmoFGopEzNGWNPcJD8/Rk8eDIye/sCA3cleV/S/Gz+bRBBJHguHKb2ejl5SOdMSGO4= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jul 2015 07:16:56.3067 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: HK2PR06MB0594 Cc: Linux-ALSA , shiiba , Liam Girdwood , komatsu , kobayashi , Simon Subject: [alsa-devel] [PATCH 29/35] ASoC: rsnd: update Audio DMA path search method 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 rsnd driver is assuming Audio DMAC / Audio DMAC peri peri are used from SSI/SSIU/SRC/DVC. But we will add CTU/MIX to this driver. Then, current DMA path searching method is not understandable, and good enough for this purpose. This patch update DMA path search method, more simply. Signed-off-by: Kuninori Morimoto Tested-by: Keita Kobayashi --- sound/soc/sh/rcar/dma.c | 88 +++++++++++++++++++++++++++++-------------------- 1 file changed, 53 insertions(+), 35 deletions(-) diff --git a/sound/soc/sh/rcar/dma.c b/sound/soc/sh/rcar/dma.c index a175863..23282f4 100644 --- a/sound/soc/sh/rcar/dma.c +++ b/sound/soc/sh/rcar/dma.c @@ -494,7 +494,7 @@ static dma_addr_t rsnd_dma_addr(struct rsnd_dai_stream *io, return rsnd_gen2_dma_addr(io, mod, is_play, is_from); } -#define MOD_MAX 4 /* MEM/SSI/SRC/DVC */ +#define MOD_MAX (RSND_MOD_MAX + 1) /* +Memory */ static void rsnd_dma_of_path(struct rsnd_dma *dma, struct rsnd_dai_stream *io, int is_play, @@ -506,53 +506,71 @@ static void rsnd_dma_of_path(struct rsnd_dma *dma, struct rsnd_mod *src = rsnd_io_to_mod_src(io); struct rsnd_mod *dvc = rsnd_io_to_mod_dvc(io); struct rsnd_mod *mod[MOD_MAX]; - int i, index; + struct rsnd_mod *mod_start, *mod_end; + struct rsnd_priv *priv = rsnd_mod_to_priv(this); + struct device *dev = rsnd_priv_to_dev(priv); + int nr, i; + if (!ssi) + return; - for (i = 0; i < MOD_MAX; i++) + nr = 0; + for (i = 0; i < MOD_MAX; i++) { mod[i] = NULL; + nr += !!rsnd_io_to_mod(io, i); + } /* - * in play case... + * [S] -*-> [E] + * [S] -*-> SRC -o-> [E] + * [S] -*-> SRC -> DVC -o-> [E] + * [S] -*-> SRC -> CTU -> MIX -> DVC -o-> [E] + * + * playback [S] = mem + * [E] = SSI * - * src -> dst + * capture [S] = SSI + * [E] = mem * - * mem -> SSI - * mem -> SRC -> SSI - * mem -> SRC -> DVC -> SSI + * -*-> Audio DMAC + * -o-> Audio DMAC peri peri */ - mod[0] = NULL; /* for "mem" */ - index = 1; - for (i = 1; i < MOD_MAX; i++) { - if (!src) { - mod[i] = ssi; - } else if (!dvc) { - mod[i] = src; - src = NULL; - } else { - if ((!is_play) && (this == src)) - this = dvc; + mod_start = (is_play) ? NULL : ssi; + mod_end = (is_play) ? ssi : NULL; - mod[i] = (is_play) ? src : dvc; - i++; - mod[i] = (is_play) ? dvc : src; + mod[0] = mod_start; + for (i = 1; i < nr; i++) { + if (src) { + mod[i] = src; src = NULL; + } else if (dvc) { + mod[i] = dvc; dvc = NULL; } - - if (mod[i] == this) - index = i; - - if (mod[i] == ssi) - break; } + mod[i] = mod_end; - if (is_play) { - *mod_from = mod[index - 1]; - *mod_to = mod[index]; + /* + * | SSI | SRC | + * -------------+-----+-----+ + * is_play | o | * | + * !is_play | * | o | + */ + if ((this == ssi) == (is_play)) { + *mod_from = mod[nr - 1]; + *mod_to = mod[nr]; } else { - *mod_from = mod[index]; - *mod_to = mod[index - 1]; + *mod_from = mod[0]; + *mod_to = mod[1]; + } + + dev_dbg(dev, "module connection (this is %s[%d])\n", + rsnd_mod_name(this), rsnd_mod_id(this)); + for (i = 0; i <= nr; i++) { + dev_dbg(dev, " %s[%d]%s\n", + rsnd_mod_name(mod[i]), rsnd_mod_id(mod[i]), + (mod[i] == *mod_from) ? " from" : + (mod[i] == *mod_to) ? " to" : ""); } } @@ -580,8 +598,8 @@ void rsnd_dma_quit(struct rsnd_dai_stream *io, struct rsnd_dma *dma) int rsnd_dma_init(struct rsnd_dai_stream *io, struct rsnd_dma *dma, int id) { - struct rsnd_mod *mod_from; - struct rsnd_mod *mod_to; + 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 device *dev = rsnd_priv_to_dev(priv);