Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp5790298imu; Tue, 13 Nov 2018 11:47:12 -0800 (PST) X-Google-Smtp-Source: AJdET5eqyyOjEf7CWz4D1FnJ51sAy8dgkDMYld8X+L+8swFaING+lyoNTB64D45eQpXUxVdfhU1f X-Received: by 2002:a17:902:15c5:: with SMTP id a5-v6mr2217429plh.136.1542138432086; Tue, 13 Nov 2018 11:47:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542138432; cv=none; d=google.com; s=arc-20160816; b=jk71arqchzpatqIjySJ1qvVdpqSRH4MK4UI6EeWi+CBPS3Ckn5QsBazRKHoHe2ymWG prwMAGPk0yBIXFnrcv49fYjYgyKFNH3dQWOjQD+7CQ0+pTzZ30/w0GeKsg31HE/4Y1Mc 3edVNL9jHlWJnaCXaAUNGrbFwlcqWQvUbBsQafzHEyzCuQukgtaYPrnjev7VaSQNpP1B W7bkGvWEqZJ6iWMEzluhgE2VO8HU0YBSdQHe8ABBwNqS6DSOgbxKWTV29AxlXGurNB4B ug8H79jFA1ssWNmA8t18BrwCTgdbWPLwuEe3DqCpZDMQCYL7J1Q6GShWy/fMgLNZqOmQ ChbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:message-id:in-reply-to:subject:cc:to :from:dkim-signature; bh=klF9s93jeBC9bL/1A7ssdNAq22QYUQB6gs9ab7PCJvo=; b=dptuKEudoNTk3kYp7+QTWpW32JVWRqp9pp4myYHzyrlbxwrmSU8wmiUhgMJUCC+sLv 5Raz8k4ME+gcKlQje1/oCT/9gUABL5IVS1O0HN4rCMbD9d9p+7JcIVmrRiWAYimqt2Db Th13ZAyre6JLxfVuZCrq5UqBrPYU1qz0J+XlkZtOk4chRq04/DP8HfxQklbz7gHUSVLs Pz8DD0TpEhqS2RLxgD05zJ8IXGEwlYyGRLgQt752Xw8ZafBwfXsav9r6/BDQU0L7gBsq G0DfjWa4jbtyk9Ad5wHs2aE5T97Tkpo6Y8eHdL+7jfIGAm96WMgIm2RG7CZz76ZDnGrH 53+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=IGpEP7FE; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u5si7465787pgr.316.2018.11.13.11.46.57; Tue, 13 Nov 2018 11:47:12 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=IGpEP7FE; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730986AbeKNFpl (ORCPT + 99 others); Wed, 14 Nov 2018 00:45:41 -0500 Received: from heliosphere.sirena.org.uk ([172.104.155.198]:51256 "EHLO heliosphere.sirena.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728686AbeKNFpl (ORCPT ); Wed, 14 Nov 2018 00:45:41 -0500 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 Cc: Maruthi Bayyavarapu , Ravulapati Vishnu vardhan Rao , Vijendar Mukunda , Mark Brown , "moderated list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER, MANAGEM..." , Maruthi Bayyavarapu , open list , Takashi Iwai , Liam Girdwood , Vishnuvardhanrao.Ravulapati@amd.com, Mark Brown , Alexander.Deucher@amd.com, alsa-devel@alsa-project.org Subject: Applied "ASoC: amd: add acp3x i2s ops" to the asoc tree 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) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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(-) 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 = { -- 2.19.1