From patchwork Mon Feb 1 17:29:20 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 8182071 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 01C659F1C0 for ; Mon, 1 Feb 2016 17:35:10 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0B429203A1 for ; Mon, 1 Feb 2016 17:35:09 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id D33812027D for ; Mon, 1 Feb 2016 17:35:07 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id EDF152660F6; Mon, 1 Feb 2016 18:35:06 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_NONE, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=no version=3.3.1 Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 6DF3B265053; Mon, 1 Feb 2016 18:30:59 +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 87AC3264FFF; Mon, 1 Feb 2016 18:30:57 +0100 (CET) Received: from mail-wm0-f49.google.com (mail-wm0-f49.google.com [74.125.82.49]) by alsa0.perex.cz (Postfix) with ESMTP id 4E0CF265053 for ; Mon, 1 Feb 2016 18:29:23 +0100 (CET) Received: by mail-wm0-f49.google.com with SMTP id p63so81558215wmp.1 for ; Mon, 01 Feb 2016 09:29:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=xo7m02gOMYXgZb55p1Nk1o7wMAY7mn+WjMj6l5pXGD4=; b=IY6gqebQpxwWZBQUeMLQJAwt6Nke+9smAT7cR0v8u1OrhsJXNII0QulTF6xqCcV0M1 BEuRCeEhHjPSPo92p/BB/HK9YtQHx5UuEBLBkErZccTI48AA4s7WIZjAsRjYfk7SuZ18 H0vk9oa9nFEydZqLrPOBc3j/V9Cd4JMPapYIQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=xo7m02gOMYXgZb55p1Nk1o7wMAY7mn+WjMj6l5pXGD4=; b=OlM4bUkQAI1gN3FSI8jDli0m0s5Cr1WAcGUVv6sEC1CprMb6BaOkoI/twFHqmdIrmW PueNvLiNuUbUDUjBPmOI6ldJ73rGwEqPTHKBXUc+jHibt0SQcSbE0ZwGPgo4oONJoRLI ttL1X/39XDetPZAI6AFz/b8SrlSazG1gRSZQS4zgDkwouaUh/r9ljP5E5m05MRVch4LQ A4oUmX/x7DB7pZryjZFwhKMoSNcVjYfk6xdp1xqbjZL3NAl5M/alDBibcSfQYWGwsbaP 1U7RlInGkHHuuOZMxG+yO7RRBefAUB6YspLe3H4eToMRvzkyh6+ZZRay8sI7qaZPt8rn 6ATw== X-Gm-Message-State: AG10YOT4BUWLiuC7k/e3QbACmhSqRx1Fj2CyeUU+jWNxzvP70/NSbFkx0fFyQgPeXjfvDaeS X-Received: by 10.194.235.4 with SMTP id ui4mr23054437wjc.177.1454347763125; Mon, 01 Feb 2016 09:29:23 -0800 (PST) Received: from localhost.localdomain (host-92-13-246-184.as43234.net. [92.13.246.184]) by smtp.gmail.com with ESMTPSA id l2sm30214750wjf.15.2016.02.01.09.29.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 01 Feb 2016 09:29:22 -0800 (PST) From: Srinivas Kandagatla To: Patrick Lai , alsa-devel@alsa-project.org Date: Mon, 1 Feb 2016 17:29:20 +0000 Message-Id: <1454347760-10856-1-git-send-email-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1454347622-9970-1-git-send-email-srinivas.kandagatla@linaro.org> References: <1454347622-9970-1-git-send-email-srinivas.kandagatla@linaro.org> Cc: Banajit Goswami , Liam Girdwood , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Takashi Iwai , Mark Brown , Srinivas Kandagatla Subject: [alsa-devel] [PATCH RFC 10/15] ASoC: qcom: apq8016: add wrdma support 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 X-Virus-Scanned: ClamAV using ClamSMTP This patch adds wrdma support in lpass-apq8016 by providing the register offsets and adding support in dma channel allocation callback. Signed-off-by: Srinivas Kandagatla --- sound/soc/qcom/lpass-apq8016.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/sound/soc/qcom/lpass-apq8016.c b/sound/soc/qcom/lpass-apq8016.c index df44f09..3eef0c3 100644 --- a/sound/soc/qcom/lpass-apq8016.c +++ b/sound/soc/qcom/lpass-apq8016.c @@ -137,11 +137,23 @@ static int apq8016_lpass_alloc_dma_channel(struct lpass_data *drvdata, int direction) { struct lpass_variant *v = drvdata->variant; - int chan = find_first_zero_bit(&drvdata->dma_ch_bit_map, + int chan = 0; + + if (direction == SNDRV_PCM_STREAM_PLAYBACK) { + chan = find_first_zero_bit(&drvdata->dma_ch_bit_map, v->rdma_channels); - if (chan >= v->rdma_channels) - return -EBUSY; + if (chan >= v->rdma_channels) + return -EBUSY; + } else { + chan = find_next_zero_bit(&drvdata->dma_ch_bit_map, + v->wrdma_channel_start + + v->wrdma_channels, + v->wrdma_channel_start); + + if (chan >= v->wrdma_channel_start + v->wrdma_channels) + return -EBUSY; + } set_bit(chan, &drvdata->dma_ch_bit_map); @@ -213,7 +225,11 @@ static struct lpass_variant apq8016_data = { .rdma_reg_base = 0x8400, .rdma_reg_stride = 0x1000, .rdma_channels = 2, - .rdmactl_audif_start = 1, + .dmactl_audif_start = 1, + .wrdma_reg_base = 0xB000, + .wrdma_reg_stride = 0x1000, + .wrdma_channel_start = 5, + .wrdma_channels = 2, .dai_driver = apq8016_lpass_cpu_dai_driver, .num_dai = ARRAY_SIZE(apq8016_lpass_cpu_dai_driver), .init = apq8016_lpass_init,