From patchwork Tue Nov 13 19:45:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 151006 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp4815625ljp; Tue, 13 Nov 2018 11:46:07 -0800 (PST) X-Google-Smtp-Source: AJdET5d+1dokO/1wcZ2S5tcarDEfwFIT6uUBX89YwcNIw5HiFGrLmdbnGO6mYTS9lmVo/RjrnBpI X-Received: by 2002:a5d:67d1:: with SMTP id n17-v6mr6202505wrw.245.1542138367588; Tue, 13 Nov 2018 11:46:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542138367; cv=none; d=google.com; s=arc-20160816; b=B0r3rWfDF0c4g7NpSKqqqZEFmP1Sz7vPrwshev5jXu01/GVd/oaVCHxoSydv1BZzpB UPfVNDCYgZPVoVH2d+WbHcrVCAbD4aNiwSuJKlPHDfrhqQh3ATS3V+BS7wIGH9alkABx 0iBbX0MHc/y3RwyQFQWYCLcLx94vR+9sEuj8F1KsdxhZz4Qi33SmcuQmzWlie/a2A/Fp uQYNNBlWVeocYEhW0ZTpKDPPjC6/Y+H3Bhj3DrqA4l1iwRgTJBRaR0KgsGMApK5UXLQb L4ymbAmJqIz7OmY8fsYsKc6XHYxv/V9szbYureg9/gITdGXdZjzTfUC5Rhd8Iys48855 lziw== 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; bh=VXkHSjI1R3R8YyurP8r/YBmxvHkt+hoafGo8koDOTGc=; b=kW4oNpMg38Fig9Fa7sO6QolKT5OMhPpodqyrTy3c5ur9zvnOzWrqS1qTJ2KS2jycSg XqFmDeiUaXqczvy4HzK+vvIpuu9gUcGXEfKtijDQtrpRzD6QTzfcOkWCRun1+hxQaQoJ wupN5iQBm3Yk2XB8OrSVAQIgbjMVx91pBudeNN5Cj9p6MX5z69kEqc8J2vblVtOjhTOB Q+Y4sA5y1pudyNF9q9M7CZx09RvcJwHahh43oji4fgnlbEi7tUXRlE0tlJSAFQjd6ylf B2zm42NWfoQWwwkF/eq7eY2sf24T9x8oftKiCSel2qHQnHrAEipbgk2fo7k5Q6AHAPud Fyxg== 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=IGpEP7FE; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from alsa0.perex.cz (alsa0.perex.cz. [77.48.224.243]) by mx.google.com with ESMTP id 51-v6si15988190wra.138.2018.11.13.11.46.07; Tue, 13 Nov 2018 11:46:07 -0800 (PST) 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=IGpEP7FE; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 1B5FC267AB9; Tue, 13 Nov 2018 20:46:06 +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 C06A7267ADD; Tue, 13 Nov 2018 20:46:03 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail1.perex.cz X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_NONE 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 E7CD5267AF1 for ; Tue, 13 Nov 2018 20:46:00 +0100 (CET) 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=klF9s93jeBC9bL/1A7ssdNAq22QYUQB6gs9ab7PCJvo=; b=IGpEP7FEQPFh XVJAIQNJNfU0N/YkB/LTO2Piyh4zupGt+MPX+47N0SC1JSb+FshL1qzhjL9XDkrPhrXeWaJRyQy3Q x9CCuUyY9FiEW0yZXbRWC1OeiQq38Z7kRcw8OUXA9ooNZ1E53fdYFiANhPEkqMkp3NsZ80BwMluvh pMb00=; Received: from [64.114.255.97] (helo=finisterre.ee.mobilebroadband) by heliosphere.sirena.org.uk with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1gMedM-0002Vl-5H; Tue, 13 Nov 2018 19:46:00 +0000 Received: by finisterre.ee.mobilebroadband (Postfix, from userid 1000) id 2C3AB440078; Tue, 13 Nov 2018 19:45:54 +0000 (GMT) From: Mark Brown To: Vijendar Mukunda In-Reply-To: <1542000903-19020-8-git-send-email-Vijendar.Mukunda@amd.com> Message-Id: <20181113194554.2C3AB440078@finisterre.ee.mobilebroadband> Date: Tue, 13 Nov 2018 19:45:54 +0000 (GMT) Cc: , alsa-devel@alsa-project.org, Maruthi Bayyavarapu , Liam Girdwood , open list , Takashi Iwai , Alexander.Deucher@amd.com, Mark Brown , Vijendar Mukunda , Vishnuvardhanrao.Ravulapati@amd.com Subject: [alsa-devel] Applied "ASoC: amd: add acp3x i2s ops" 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: amd: add acp3x i2s ops has been applied to the asoc tree at https://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 2b5f290e10266037338631c03ab6bea51f0a7ebf Mon Sep 17 00:00:00 2001 From: Vijendar Mukunda Date: Mon, 12 Nov 2018 11:04:58 +0530 Subject: [PATCH] ASoC: amd: add acp3x i2s ops ACP3x has a i2s controller block for playback and capture. This patch adds ACP3x i2s DAI operations. Signed-off-by: Maruthi Bayyavarapu Tested-by: Ravulapati Vishnu vardhan Rao Signed-off-by: Vijendar Mukunda Signed-off-by: Mark Brown --- sound/soc/amd/raven/acp3x-pcm-dma.c | 89 ++++++++++++++++++++++++++++- 1 file changed, 86 insertions(+), 3 deletions(-) -- 2.19.1 _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/alsa-devel diff --git a/sound/soc/amd/raven/acp3x-pcm-dma.c b/sound/soc/amd/raven/acp3x-pcm-dma.c index 06c1985c4d56..ed2c16379d2c 100644 --- a/sound/soc/amd/raven/acp3x-pcm-dma.c +++ b/sound/soc/amd/raven/acp3x-pcm-dma.c @@ -423,10 +423,93 @@ static struct snd_pcm_ops acp3x_dma_ops = { .mmap = acp3x_dma_mmap, }; +static int acp3x_dai_i2s_hwparams(struct snd_pcm_substream *substream, + struct snd_pcm_hw_params *params, + struct snd_soc_dai *dai) +{ + u32 val = 0; + struct i2s_stream_instance *rtd = substream->runtime->private_data; + + switch (params_format(params)) { + case SNDRV_PCM_FORMAT_U8: + case SNDRV_PCM_FORMAT_S8: + rtd->xfer_resolution = 0x0; + break; + case SNDRV_PCM_FORMAT_S16_LE: + rtd->xfer_resolution = 0x02; + break; + case SNDRV_PCM_FORMAT_S24_LE: + rtd->xfer_resolution = 0x04; + break; + case SNDRV_PCM_FORMAT_S32_LE: + rtd->xfer_resolution = 0x05; + break; + default: + return -EINVAL; + } + val = rv_readl(rtd->acp3x_base + mmACP_BTTDM_ITER); + val = val | (rtd->xfer_resolution << 3); + if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) + rv_writel(val, rtd->acp3x_base + mmACP_BTTDM_ITER); + else + rv_writel(val, rtd->acp3x_base + mmACP_BTTDM_IRER); + + return 0; +} + +static int acp3x_dai_i2s_trigger(struct snd_pcm_substream *substream, + int cmd, struct snd_soc_dai *dai) +{ + int ret = 0; + struct i2s_stream_instance *rtd = substream->runtime->private_data; + u32 val, period_bytes; + + period_bytes = frames_to_bytes(substream->runtime, + substream->runtime->period_size); + switch (cmd) { + case SNDRV_PCM_TRIGGER_START: + case SNDRV_PCM_TRIGGER_RESUME: + case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: + if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { + rv_writel(period_bytes, rtd->acp3x_base + + mmACP_BT_TX_INTR_WATERMARK_SIZE); + val = rv_readl(rtd->acp3x_base + mmACP_BTTDM_ITER); + val = val | BIT(0); + rv_writel(val, rtd->acp3x_base + mmACP_BTTDM_ITER); + } else { + rv_writel(period_bytes, rtd->acp3x_base + + mmACP_BT_RX_INTR_WATERMARK_SIZE); + val = rv_readl(rtd->acp3x_base + mmACP_BTTDM_IRER); + val = val | BIT(0); + rv_writel(val, rtd->acp3x_base + mmACP_BTTDM_IRER); + } + rv_writel(1, rtd->acp3x_base + mmACP_BTTDM_IER); + break; + case SNDRV_PCM_TRIGGER_STOP: + case SNDRV_PCM_TRIGGER_SUSPEND: + case SNDRV_PCM_TRIGGER_PAUSE_PUSH: + if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { + val = rv_readl(rtd->acp3x_base + mmACP_BTTDM_ITER); + val = val & ~BIT(0); + rv_writel(val, rtd->acp3x_base + mmACP_BTTDM_ITER); + } else { + val = rv_readl(rtd->acp3x_base + mmACP_BTTDM_IRER); + val = val & ~BIT(0); + rv_writel(val, rtd->acp3x_base + mmACP_BTTDM_IRER); + } + rv_writel(0, rtd->acp3x_base + mmACP_BTTDM_IER); + break; + default: + ret = -EINVAL; + break; + } + + return ret; +} + struct snd_soc_dai_ops acp3x_dai_i2s_ops = { - .hw_params = NULL, - .trigger = NULL, - .set_fmt = NULL, + .hw_params = acp3x_dai_i2s_hwparams, + .trigger = acp3x_dai_i2s_trigger, }; static struct snd_soc_dai_driver acp3x_i2s_dai_driver = {