From patchwork Thu Feb 11 12:19:30 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 8278981 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 8066ABEEE5 for ; Thu, 11 Feb 2016 12:29:40 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BE17B20397 for ; Thu, 11 Feb 2016 12:29:39 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 90259201FA for ; Thu, 11 Feb 2016 12:29:38 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id D8F502659C7; Thu, 11 Feb 2016 13:29:32 +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 A0591265A98; Thu, 11 Feb 2016 13:23:23 +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 21EA7265AAC; Thu, 11 Feb 2016 13:23:22 +0100 (CET) Received: from mail-wm0-f50.google.com (mail-wm0-f50.google.com [74.125.82.50]) by alsa0.perex.cz (Postfix) with ESMTP id 72EBF265AF2 for ; Thu, 11 Feb 2016 13:19:33 +0100 (CET) Received: by mail-wm0-f50.google.com with SMTP id 128so18664766wmz.1 for ; Thu, 11 Feb 2016 04:19:33 -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=WPMJKcsyz4d5CAqN8cDdx0g8lXvReCfB0vhUqqn/FAQ=; b=LXxRY0b6QRzwxgT8RDlCGmpT6anJ0LD98HFzyFbwdT0h3QV5zEBJj+ANBlJp8TmFfm 9J6BbLlVMH7yItkg8uYo3uHQh0quLF3IBCogMZzofNRBBe6VevMgn+TPvYGbsuKjtqFS 2SzwOvMHeZrPmNfxi/4UqFGvH2Z97N2wjewlY= 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=WPMJKcsyz4d5CAqN8cDdx0g8lXvReCfB0vhUqqn/FAQ=; b=OutnE3BS3PxLhnAz1WJnnX56gzky7Lhqk5gCMIxmYK2Dlkylsp4deQC32W1iG55AFh 83vAWGBPVkZbQc9NbYW2o84p5SXCtObZQY9LJRddnDy8RDWi/lpVWPrg61e4Xp1MuiK3 P7MD9oCRW8STsqifduseYAbJYuQ2nJqBq7YXwzLKgKwym885Y+UZuI/58eetvxhzc8ZW wforHt1hnaqyUz6nPDw4Y9xBZEzjny4YzqKTHa/0NpCIALOCDZ8+wP+fapoHRPEt07UX YmygHnzejmJYnl2Rxxtbx3mhZGi8rLleVksmHu4WBJDcVKvEB5cUGlpa6MPAixVnhuKa rXmA== X-Gm-Message-State: AG10YORZmkosLsumQvemvgZKUhC7f0KRGuwaBJviLai+MVPDDV1XIJm6bkifjZKQz2hPE/lF X-Received: by 10.28.55.76 with SMTP id e73mr18016902wma.53.1455193173268; Thu, 11 Feb 2016 04:19:33 -0800 (PST) Received: from localhost.localdomain (host-92-13-246-184.as43234.net. [92.13.246.184]) by smtp.gmail.com with ESMTPSA id x65sm7766524wmg.4.2016.02.11.04.19.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 11 Feb 2016 04:19:32 -0800 (PST) From: Srinivas Kandagatla To: Patrick Lai , alsa-devel@alsa-project.org, Mark Brown Date: Thu, 11 Feb 2016 12:19:30 +0000 Message-Id: <1455193170-2169-1-git-send-email-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1455193007-1481-1-git-send-email-srinivas.kandagatla@linaro.org> References: <1455193007-1481-1-git-send-email-srinivas.kandagatla@linaro.org> Cc: kwestfie@codeaurora.org, Banajit Goswami , Liam Girdwood , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Takashi Iwai , Srinivas Kandagatla Subject: [alsa-devel] [PATCH v3 08/14] 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 Acked-by: Kenneth Westfield --- sound/soc/qcom/lpass-apq8016.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/sound/soc/qcom/lpass-apq8016.c b/sound/soc/qcom/lpass-apq8016.c index ca3bbd5..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); @@ -214,6 +226,10 @@ static struct lpass_variant apq8016_data = { .rdma_reg_stride = 0x1000, .rdma_channels = 2, .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,