Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3689388imu; Sun, 11 Nov 2018 21:34:02 -0800 (PST) X-Google-Smtp-Source: AJdET5eyyiaga/J+4A2oiCBgrplpZjwbHIdNO6Fu1MtZSqlw9cj66yQL21ML62NIet/GiVV2RLeR X-Received: by 2002:a63:61c8:: with SMTP id v191mr16438306pgb.242.1542000842338; Sun, 11 Nov 2018 21:34:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542000842; cv=none; d=google.com; s=arc-20160816; b=TGH18/5qkRye1r7UyBueasnX3abzDMzI2LtLLQP6iYldCL/4/IrRND1Qd6g6S9Ic2r SRRErXBXeB8LxcvslZzDye6qnxUiJ8yBXXXChktYS38PAF9N8bJtgRkg4xaW0e56QBDe PBA8Hc1JHEHBtyCfGL31YlawLOHX94M5uAb3iD+aP+XHKoJA05mie+PXNZyRtxErVgbq pms12yOfWbosghgjKqzhDKXB19wths8Sc/v//0BmEAjdJ9xnoeo0Fs+9ve8TpIjBWZ80 4PAI2kt+ZVtkTPLxce7AaC/DlMt3572YjCXREMkDhV+rRx9JJLvdfbLCk6cnSzjlaC9f XE+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:spamdiagnosticmetadata :spamdiagnosticoutput:mime-version:references:in-reply-to:message-id :date:subject:cc:from:dkim-signature; bh=Zr/J4DlQESVu3gvUVbV04lhjVZtlgjS2VLwWFICoKFo=; b=W7VQrS/Vnb/KJjb1mumvR2nX5feDCjWXrwVkNJI/Jk7ePX8g0p67NnK/AHx2nMaC9x +x+Yf+lF0ArhczdnOeOrHdsYy46UDu2WfMOBc3utv35MfBX0CDc2X5YLiKrd8rtBjYlh /NsCHvAcdV3nWIdCYhaB2T6nP+t7uJt3GjTihOjw2UbaF4p994+2Tc1q1QcYQKUpUzuE +T6Ejj7+i+oV6zK8tKNjzLnaec17e0yBksC8jLFE/JCF4wuVgYAFQp1yeDKsMQQW5mkB i1h6NUnGSRTfIB1tZQAo01knb7VWoMNuWmbWZBGS9iVKZizOH5VSDnGITumhDJWTgMbo OmqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amdcloud.onmicrosoft.com header.s=selector1-amd-com header.b=Semk9Wi8; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o10-v6si15192288pgg.389.2018.11.11.21.33.47; Sun, 11 Nov 2018 21:34:02 -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=pass header.i=@amdcloud.onmicrosoft.com header.s=selector1-amd-com header.b=Semk9Wi8; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731416AbeKLPYg (ORCPT + 99 others); Mon, 12 Nov 2018 10:24:36 -0500 Received: from mail-sn1nam02on0050.outbound.protection.outlook.com ([104.47.36.50]:2704 "EHLO NAM02-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727826AbeKLPYg (ORCPT ); Mon, 12 Nov 2018 10:24:36 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Zr/J4DlQESVu3gvUVbV04lhjVZtlgjS2VLwWFICoKFo=; b=Semk9Wi8axzUVoDIsy5gPIwj4MS8g4xte1XbIhgmXDmg3y3dM+SrIVbwTgEnVsOEF9ZRgnehzkWV9nZXVZM6ZQrLUgBoZDnsc55jR1XMm4a4/ecPCCmvfr5A0mylq5NwbXTwKg9tlOMRzyIHI3/THcts7J5CrEB1xHXJZaGuwCk= Received: from BN6PR12CA0026.namprd12.prod.outlook.com (2603:10b6:405:70::12) by DM3PR12MB0747.namprd12.prod.outlook.com (2a01:111:e400:5984::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1294.26; Mon, 12 Nov 2018 05:32:56 +0000 Received: from CO1NAM03FT004.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e48::207) by BN6PR12CA0026.outlook.office365.com (2603:10b6:405:70::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1294.26 via Frontend Transport; Mon, 12 Nov 2018 05:32:55 +0000 Authentication-Results: spf=none (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; suse.com; dkim=none (message not signed) header.d=none;suse.com; dmarc=permerror action=none header.from=amd.com; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from SATLEXCHOV01.amd.com (165.204.84.17) by CO1NAM03FT004.mail.protection.outlook.com (10.152.80.154) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1339.10 via Frontend Transport; Mon, 12 Nov 2018 05:32:54 +0000 Received: from LinuxHost.amd.com (10.34.1.3) by SATLEXCHOV01.amd.com (10.181.40.71) with Microsoft SMTP Server id 14.3.389.1; Sun, 11 Nov 2018 23:32:52 -0600 From: Vijendar Mukunda CC: , , , Vijendar Mukunda , Maruthi Bayyavarapu , Liam Girdwood , "Mark Brown" , Jaroslav Kysela , Takashi Iwai , "moderated list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEM..." , open list Subject: [PATCH 07/11] ASoC: amd: add acp3x i2s ops Date: Mon, 12 Nov 2018 11:04:58 +0530 Message-ID: <1542000903-19020-8-git-send-email-Vijendar.Mukunda@amd.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1542000903-19020-1-git-send-email-Vijendar.Mukunda@amd.com> References: <1542000903-19020-1-git-send-email-Vijendar.Mukunda@amd.com> MIME-Version: 1.0 Content-Type: text/plain X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:165.204.84.17;IPV:NLI;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(346002)(376002)(396003)(136003)(39860400002)(2980300002)(428003)(199004)(189003)(446003)(53416004)(305945005)(109986005)(50466002)(105586002)(106466001)(1671002)(36756003)(48376002)(54906003)(8676002)(14444005)(50226002)(8936002)(81156014)(81166006)(11346002)(16586007)(336012)(26005)(356004)(77096007)(53936002)(316002)(5660300001)(68736007)(4326008)(51416003)(426003)(39060400002)(7696005)(47776003)(104016004)(186003)(76176011)(86362001)(126002)(486006)(2906002)(2616005)(478600001)(476003)(72206003)(97736004)(42413003)(266003)(32563001);DIR:OUT;SFP:1101;SCL:1;SRVR:DM3PR12MB0747;H:SATLEXCHOV01.amd.com;FPR:;SPF:None;LANG:en;PTR:InfoDomainNonexistent;A:1;MX:1; X-Microsoft-Exchange-Diagnostics: 1;CO1NAM03FT004;1:3h/ULVYuUXzWWkBMfCmHsPnRDMAahabhzTfH99fSWdLr6ql9KWJPFgVBCyTYf1EDaZTrXPmv/4hf0qbuqoP+MzkdOwd16oYrXEs4OMv4s8JaCrVhF5KofWBiLi7xwoZH X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 498ca6b4-a9ad-4e41-f547-08d648604be2 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390040)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060);SRVR:DM3PR12MB0747; X-Microsoft-Exchange-Diagnostics: 1;DM3PR12MB0747;3:1hGJroeFUpunIG+PA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nXjcPU56yrPjRyjExJuOpt9wbClCvYY169HuDXyvsXcWMyhCW9Tgq4Iul5c4ulZF6w0EKFv+aZMNtG4VgwU/TKQTC7ManWmwF7ldm8NcRhCC2h9Zb4Kdr5387FrKf9mpFBoQeKm/sWMcGwp1I/KexVilHk770qpRMMmedz2xfGYY88yuw923ylyl22XiPW4CiyqQClcZ0PbrTHWYoqJGqXuBHULfgbHdpSVv7/aCA/kPCaSR0DEXvnTYSjd1PegZD5gba6XyOsB2nuNrlVpKgceNe/bXF07SKxSotMdrkvaapveQhr9RkWJ96WR4ePdlMmCBdjZPLvyYJr5ZpIQF51xg6Flgz4sR5nuYrVX8zATCTbhWPQAZMoKIrek4mowzycGFzuVmAHhOCg4LizLnniJVB28WimJH4ZT/ZTKDV1TgwXF4tFr/UGBWfsJjCFkRtx3P8+2L/16FiGDfmGgP X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3231382)(944501410)(52105112)(93006095)(93003095)(10201501046)(3002001)(6055026)(148016)(149066)(150057)(6041310)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123558120)(20161123564045)(201708071742011)(7699051)(76991095);SRVR:DM3PR12MB0747;BCL:0;PCL:0;RULEID:;SRVR:DM3PR12MB0747; X-Microsoft-Exchange-Diagnostics: 1;DM3PR12MB0747;4:d5WGLjk/kQFVK6YfEsaxIygHIZagBokOZmQ9KKPKAEjOv5J8WBPwPRHW9vXelSAwqKSd1mVqI3OACVitYNWEOlkWyXJxYRn7/iRhuu6yM0VEzWqsjJ3+Jt4o3jSMWUCA90jw2AxVjiHfFgBWjloQrxIzIkzVeWR7xoyhtw9PrRx+V9JLBhh3RXBzn3s/6iTHr9/tEMJwwNqOnRzM8S2YXgfb3nbrnR+uSY8S/uRq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ZS6nAIBpADHxqqjF7MMThjnQrgrze48Bz0Z8ywxNymFj3iXZsUg3TavPUaUEhH+9N X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Nov 2018 05:32:54.3447 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 498ca6b4-a9ad-4e41-f547-08d648604be2 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXCHOV01.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM3PR12MB0747 To: unlisted-recipients:; (no To-header on input) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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 06c1985..ed2c163 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.7.4