From patchwork Thu Sep 21 17:34:55 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 113920 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp2289696qgf; Thu, 21 Sep 2017 10:35:09 -0700 (PDT) X-Google-Smtp-Source: AOwi7QD2D3w7SWjIn5+YwUvBdHr3R/CrX5Cnu5my1/qj8FYQEK9hTNeaSzDidbLKTAXIODTE8dRm X-Received: by 10.28.39.68 with SMTP id n65mr1622436wmn.122.1506015309321; Thu, 21 Sep 2017 10:35:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506015309; cv=none; d=google.com; s=arc-20160816; b=VfGX7ETdPvSF81Y/KLFPs9u8bid4ptHNpHxfggW/3v6HYTEMuWWCmgac5uaILRhx+h +UtqGBabtgckWiS44rIDNtTHbEIn0GI+32t8KAI7ghH+aNtO14TwET9KIuIMOZg4aCUx KTc9aWyNimMD1gYFWiux6ImrS6xMrlnHu25O533aYtDJtAHCZA/hn1Ybn87T1Gkwltbe 9cZ1sajvKRIpERBkKNTHsoSIcT1u4UGbZmsZafRz0XTgMeb21E60EIkLe2KPmTm/2EzX o0OcdD3rhCRGeEJJu/9v4dQXX2uh5ma/lSLMbwNY6T0ehZa7Ma/+STXkRVZDtEVIP3hR xJmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:date:message-id:in-reply-to:to:from :dkim-signature:delivered-to:arc-authentication-results; bh=n0h/AHVGLWWfur6O8qQYv7xRJ2CDbi8CbAl2XxsY5jg=; b=NGbtHaMRPRlFRNUHdYrT+QcuBB5u+zcSZ4TY8PSAVze7ocYRpTDUloG4zQhGWUW+jI nCxYq4eTmxqCZCXJC3fRrjirHzSkPjywIn23w/uq+LhNxt+p/ZXxGrfjkRTMGrMxMWSP K/utndl6huP+L5E+Re3MDiGgLZuOvkbLCkIHV81wjuoAWWVy63ywQNfLIWZ9Z5dgp/JG m3th8eOUfUWUcmd8YynTKan3UADDBS0HQ2QIiZkeeXCik45D/9n3Uq0FZy86uXT71QCK HRn9inT1WaN/uKJRJm9Ja7fVYRQo9N73G7jhnYQotqIzLfTt6pvS+DNQB/it28yZMqpW M8FA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=jMJRzFYk; spf=pass (google.com: domain of alsa-devel-bounces@alsa-project.org designates 77.48.224.243 as permitted sender) smtp.mailfrom=alsa-devel-bounces@alsa-project.org Return-Path: Received: from alsa0.perex.cz (alsa0.perex.cz. [77.48.224.243]) by mx.google.com with ESMTP id 74si1463093wrm.334.2017.09.21.10.35.08; Thu, 21 Sep 2017 10:35:09 -0700 (PDT) Received-SPF: pass (google.com: domain of alsa-devel-bounces@alsa-project.org designates 77.48.224.243 as permitted sender) client-ip=77.48.224.243; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=jMJRzFYk; spf=pass (google.com: domain of alsa-devel-bounces@alsa-project.org designates 77.48.224.243 as permitted sender) smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id B226E2675FA; Thu, 21 Sep 2017 19:35:07 +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 74ECB267602; Thu, 21 Sep 2017 19:35:05 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail1.perex.cz X-Spam-Level: X-Spam-Status: No, score=0.7 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, SPF_NEUTRAL autolearn=disabled version=3.4.0 Received: from heliosphere.sirena.org.uk (heliosphere.sirena.org.uk [172.104.155.198]) by alsa0.perex.cz (Postfix) with ESMTP id D3D2A2675F7 for ; Thu, 21 Sep 2017 19:35:02 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sirena.org.uk; s=20170815-heliosphere; h=Date:Message-Id:In-Reply-To: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:References: List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner: List-Archive; bh=PO4gex00bcRW3/vKjuaSFGfD/AZoeF1nT7eYt0t/ZEs=; b=jMJRzFYkyqTt HAbP/i3ZVIICW7O3UvAQ9QVdk4LhLv7Aj0onm66p7RhkyGmtsgpx5K2FIdBJqpgXvom6b8yuYy4TF ZCrxaL7MKX+IS+gFA8C4NBxta/LspyiRUwGUR9EIrfdYqjlZhLVm/XL4RNRijEfKF4WThQzPgC+P5 AhYZQ=; Received: from debutante.sirena.org.uk ([2001:470:1f1d:6b5::3] helo=debutante) by heliosphere.sirena.org.uk with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1dv5NI-0007yi-O9; Thu, 21 Sep 2017 17:34:56 +0000 Received: from broonie by debutante with local (Exim 4.89) (envelope-from ) id 1dv5NH-0001QI-Rr; Thu, 21 Sep 2017 18:34:55 +0100 From: Mark Brown To: Kuninori Morimoto In-Reply-To: <877exjniwl.wl%kuninori.morimoto.gx@renesas.com> Message-Id: Date: Thu, 21 Sep 2017 18:34:55 +0100 Cc: alsa-devel@alsa-project.org, Mark Brown , Simon Subject: [alsa-devel] Applied "ASoC: rsnd: add rsnd_dma_alloc()" to the asoc tree 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: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org The patch ASoC: rsnd: add rsnd_dma_alloc() has been applied to the asoc tree at git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted. You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed. If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced. Please add any relevant lists and maintainers to the CCs when replying to this mail. Thanks, Mark >From 81cb71240e202a8086bda0755d9d78bd3decd0aa Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Wed, 20 Sep 2017 06:28:44 +0000 Subject: [PATCH] ASoC: rsnd: add rsnd_dma_alloc() R-Car sound DMA will be used from SSI/SRC. dma.c doesn't alloc DMA handler in .probe timing, because we don't know what kind of DMA transfer will be used then. Thus, SSI/SRC have *rsnd_mod for DMA. rsnd_dma_attach() will allocate it and attach it to system. It will be PIO mode if it can't alloc DMA handler. In case of MIX is used, rsnd_dma_attach() will be called twice from SSI. To avoid duplicate allocation, current rsnd_dma_attach() is checking allocated DMA handler. This DMA related operation is a little bit difficult to understand. This patch adds new rsnd_dma_alloc() and separates allocation and attach for readable code. Signed-off-by: Kuninori Morimoto Signed-off-by: Mark Brown --- sound/soc/sh/rcar/dma.c | 60 +++++++++++++++++++++++++++---------------------- 1 file changed, 33 insertions(+), 27 deletions(-) -- 2.14.1 _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/alsa-devel diff --git a/sound/soc/sh/rcar/dma.c b/sound/soc/sh/rcar/dma.c index 041ec1080d52..17220c946ff0 100644 --- a/sound/soc/sh/rcar/dma.c +++ b/sound/soc/sh/rcar/dma.c @@ -753,14 +753,15 @@ static void rsnd_dma_of_path(struct rsnd_mod *this, } } -int rsnd_dma_attach(struct rsnd_dai_stream *io, struct rsnd_mod *mod, - struct rsnd_mod **dma_mod) +static int rsnd_dma_alloc(struct rsnd_dai_stream *io, struct rsnd_mod *mod, + 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 device *dev = rsnd_priv_to_dev(priv); + struct rsnd_dma *dma; struct rsnd_mod_ops *ops; enum rsnd_mod_type type; int (*attach)(struct rsnd_dai_stream *io, struct rsnd_dma *dma, @@ -800,40 +801,45 @@ int rsnd_dma_attach(struct rsnd_dai_stream *io, struct rsnd_mod *mod, type = RSND_MOD_AUDMA; } - if (!(*dma_mod)) { - struct rsnd_dma *dma; + dma = devm_kzalloc(dev, sizeof(*dma), GFP_KERNEL); + if (!dma) + return -ENOMEM; - dma = devm_kzalloc(dev, sizeof(*dma), GFP_KERNEL); - if (!dma) - return -ENOMEM; + *dma_mod = rsnd_mod_get(dma); - *dma_mod = rsnd_mod_get(dma); + ret = rsnd_mod_init(priv, *dma_mod, ops, NULL, + rsnd_mod_get_status, type, dma_id); + if (ret < 0) + return ret; - ret = rsnd_mod_init(priv, *dma_mod, ops, NULL, - rsnd_mod_get_status, type, dma_id); - if (ret < 0) - return ret; + 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, mod_from, mod_to); + if (ret < 0) + return ret; - 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->src_addr = rsnd_dma_addr(io, mod_from, is_play, 1); + dma->dst_addr = rsnd_dma_addr(io, mod_to, is_play, 0); + dma->mod_from = mod_from; + dma->mod_to = mod_to; + + return 0; +} + +int rsnd_dma_attach(struct rsnd_dai_stream *io, struct rsnd_mod *mod, + struct rsnd_mod **dma_mod) +{ + if (!(*dma_mod)) { + int ret = rsnd_dma_alloc(io, mod, dma_mod); - ret = attach(io, dma, mod_from, mod_to); if (ret < 0) return 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); - dma->mod_from = mod_from; - dma->mod_to = mod_to; } - ret = rsnd_dai_connect(*dma_mod, io, type); - if (ret < 0) - return ret; - - return 0; + return rsnd_dai_connect(*dma_mod, io, (*dma_mod)->type); } int rsnd_dma_probe(struct rsnd_priv *priv)