From patchwork Thu Feb 19 03:52:41 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 5849901 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: X-Original-To: patchwork-linux-sh@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 E7F049F269 for ; Thu, 19 Feb 2015 03:52:47 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0BD1D2012D for ; Thu, 19 Feb 2015 03:52:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1CB8F20211 for ; Thu, 19 Feb 2015 03:52:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752223AbbBSDwp (ORCPT ); Wed, 18 Feb 2015 22:52:45 -0500 Received: from relmlor2.renesas.com ([210.160.252.172]:17068 "EHLO relmlie1.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751793AbbBSDwp (ORCPT ); Wed, 18 Feb 2015 22:52:45 -0500 Received: from unknown (HELO relmlir1.idc.renesas.com) ([10.200.68.151]) by relmlie1.idc.renesas.com with ESMTP; 19 Feb 2015 12:52:44 +0900 Received: from relmlac3.idc.renesas.com (relmlac3.idc.renesas.com [10.200.69.23]) by relmlir1.idc.renesas.com (Postfix) with ESMTP id 619984208C; Thu, 19 Feb 2015 12:52:44 +0900 (JST) Received: by relmlac3.idc.renesas.com (Postfix, from userid 0) id 4540E1806F; Thu, 19 Feb 2015 12:52:44 +0900 (JST) Received: from relmlac3.idc.renesas.com (localhost [127.0.0.1]) by relmlac3.idc.renesas.com (Postfix) with ESMTP id 3E4321800A; Thu, 19 Feb 2015 12:52:44 +0900 (JST) Received: from relmlii2.idc.renesas.com [10.200.68.66] by relmlac3.idc.renesas.com with ESMTP id NAC04393; Thu, 19 Feb 2015 12:52:44 +0900 X-IronPort-AV: E=Sophos;i="5.09,606,1418050800"; d="scan'208";a="181302302" Received: from mail-hk1lp0125.outbound.protection.outlook.com (HELO APAC01-HK1-obe.outbound.protection.outlook.com) ([207.46.51.125]) by relmlii2.idc.renesas.com with ESMTP/TLS/AES256-SHA; 19 Feb 2015 12:52:43 +0900 Received: from remon.renesas.com (211.11.155.132) by SIXPR06MB175.apcprd06.prod.outlook.com (10.242.151.22) with Microsoft SMTP Server (TLS) id 15.1.87.18; Thu, 19 Feb 2015 03:52:41 +0000 Message-ID: <87egpm1rqf.wl%kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH 12/19] ASoC: rsnd: dma-names cares 1st DMAC only User-Agent: Wanderlust/2.14.0 Emacs/23.3 Mule/6.0 To: Vinod Koul , Mark Brown , Arnd Bergmann CC: Simon , Linux-SH , Linux-ALSA , Liam Girdwood , Laurent In-Reply-To: <87vbiy1rul.wl%kuninori.morimoto.gx@renesas.com> References: <87vbiy1rul.wl%kuninori.morimoto.gx@renesas.com> MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Date: Thu, 19 Feb 2015 03:52:41 +0000 X-Originating-IP: [211.11.155.132] X-ClientProxiedBy: SG2PR03CA0014.apcprd03.prod.outlook.com (25.160.233.24) To SIXPR06MB175.apcprd06.prod.outlook.com (10.242.151.22) Authentication-Results: intel.com; dkim=none (message not signed) header.d=none; X-Microsoft-Antispam: UriScan:; X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:;SRVR:SIXPR06MB175; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(5005003); SRVR:SIXPR06MB175; X-Forefront-PRVS: 0492FD61DD X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(6009001)(50466002)(83506001)(77096005)(33646002)(46102003)(92566002)(229853001)(36756003)(46406003)(40100003)(42186005)(122386002)(53416004)(47776003)(575784001)(86362001)(62966003)(54356999)(77156002)(66066001)(76176999)(19580395003)(19580405001)(2950100001)(50986999)(23726002)(87976001); DIR:OUT; SFP:1102; SCL:1; SRVR:SIXPR06MB175; H:remon.renesas.com; FPR:; SPF:None; MLV:sfv; LANG:en; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:;SRVR:SIXPR06MB175; X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Feb 2015 03:52:41.3204 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: SIXPR06MB175 Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Kuninori Morimoto Renesas R-Car sound (= rsnd) needs 2 DMAC which are called as Audio DMAC (= 1st DMAC) and Audio DMAC peri peri (2nd DMAC). And rsnd had assumed that 1st / 2nd DMACs are implemented as DMAEngine. But, in result of DMA ML discussion, 2nd DMAC was concluded that it is not a general purpose DMAC (2nd DMAC is for Device to Device inside sound system). Additionally, current DMAEngine can't support Device to Device, and we don't have correct DT bindings for it at this point. So the easiest solution for it is that move it from DMAEngine to rsnd driver. dma-names on DT was implemented as no difference between 1st / 2nd DMAC's, since rsnd had assumed that both DMACs are implemented as DMAEngine. That style was "src_dst". But now, 2nd DMAC was implemented as non DMAEngine, and it doesn't need dma-names anymore. So, this dma-names rule is no longer needed. In upstream code, no SoC/platform is supporting DMA for rsnd driver yet. This means there is no compatible issue if this patch changes dma-names's naming rule of DT. This patch assumes dma-names are tx/rx base for 1st DMAC on DT. ex) "mem_ssi0" -> "ssi0-rx" "ssi0_mem" -> "ssi0-tx" Signed-off-by: Kuninori Morimoto --- sound/soc/sh/rcar/dma.c | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/sound/soc/sh/rcar/dma.c b/sound/soc/sh/rcar/dma.c index 9cb5785..5b0c344 100644 --- a/sound/soc/sh/rcar/dma.c +++ b/sound/soc/sh/rcar/dma.c @@ -54,25 +54,28 @@ static void rsnd_dmaen_complete(void *data) #define DMA_NAME_SIZE 16 #define MOD_MAX 4 /* MEM/SSI/SRC/DVC */ -static int _rsnd_dmaen_of_name(char *dma_name, struct rsnd_mod *mod) -{ - if (mod) - return snprintf(dma_name, DMA_NAME_SIZE / 2, "%s%d", - rsnd_mod_dma_name(mod), rsnd_mod_id(mod)); - else - return snprintf(dma_name, DMA_NAME_SIZE / 2, "mem"); - -} static void rsnd_dmaen_of_name(struct rsnd_mod *mod_from, struct rsnd_mod *mod_to, char *dma_name) { - int index = 0; + char *fmt; + struct rsnd_mod *mod; + + if ((!mod_from && !mod_to) || + (mod_from && mod_to)) + return; + + if (mod_from) { + fmt = "%s%d-tx"; + mod = mod_from; + } else { + fmt = "%s%d-rx"; + mod = mod_to; + } - index = _rsnd_dmaen_of_name(dma_name + index, mod_from); - *(dma_name + index++) = '_'; - index = _rsnd_dmaen_of_name(dma_name + index, mod_to); + snprintf(dma_name, DMA_NAME_SIZE, fmt, + rsnd_mod_dma_name(mod), rsnd_mod_id(mod)); } static void rsnd_dmaen_stop(struct rsnd_dma *dma)