Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp587809ybc; Tue, 19 Nov 2019 06:14:14 -0800 (PST) X-Google-Smtp-Source: APXvYqyoxGGNcUEMbb9nF05Zs2cutEeKOWpvVFbe7nUNGQ5frhlA7U7uedBXTbS8+7YWmp+P4RRV X-Received: by 2002:a17:906:4e94:: with SMTP id v20mr36121626eju.34.1574172854108; Tue, 19 Nov 2019 06:14:14 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1574172854; cv=pass; d=google.com; s=arc-20160816; b=eVZeoF3WZ+2SWeaVHjTJGWJCLum/jGfgZUPBp7rUARGBie4uDR9BVredFMCJRWhP5w 8Mt7rAOitueh57+TW8NO4mMbSGS/pn67uf9oV6Zu4eYtoC/KmUuhLIEt9E2Ppns5PGG1 ZQXxx3OUTmBNjzW3YABRxYA7+6eye/yC2d/kcIMfuoOTrYcQ990GXXaXu/Mm1/PBqj87 raYDzcq+3yiEasPZ3enW9KqG4P5MWJ3oGK5Op3+u3mPB5Tb8GCVGy0wTYvGTpnW9uPen NkIIJMmE5BqRHWKxQezKcqdvlxLqizoqly/uFeSDPAjkpf2BFh6fVvnNwzwv9/pUtmfz WE4A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:mime-version:references:in-reply-to :message-id:date:subject:cc:from:dkim-signature; bh=SdqAZdh5U6sOBgDkyVbY7DpGtb3eXsXXJFDNqcmuy34=; b=wlMzgVROS4G9f3rCjCQKQdyynMTs+QrtHknj37UMyEpGiI09zfZ6Eo6BBfrwpgv+YH 8lOm8+Gy8sCfCsaMu4vvMMkRoVlYpDtIbAv0fyLWFeJkRlxbFztn3I6wzU9C6sXcS/TS OK5K7ysrmiSv4Rk1soSb0EJ7l33hNtsx/8qB6olkJkLt7lsdKE0smc/OQojDnfIBSc8C YVoyIN/EV9ibuhSAqUq3I2yEwmUwX2KG3SdnmWjnuHQNiXts/fueCni0cOj3tt3f46pA aSYscLA6vw1qEp4HlKaqo+24S+rJqHuila2H9OrFAzPY3f6d2xqDJ3ePR7n9wg+1U6ok ZYJg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amdcloud.onmicrosoft.com header.s=selector2-amdcloud-onmicrosoft-com header.b=nwl+Ckqo; arc=pass (i=1); 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 h6si13685142ejt.227.2019.11.19.06.13.48; Tue, 19 Nov 2019 06:14:14 -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=selector2-amdcloud-onmicrosoft-com header.b=nwl+Ckqo; arc=pass (i=1); 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 S1728236AbfKSOKV (ORCPT + 99 others); Tue, 19 Nov 2019 09:10:21 -0500 Received: from mail-eopbgr800087.outbound.protection.outlook.com ([40.107.80.87]:62707 "EHLO NAM03-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726185AbfKSOKT (ORCPT ); Tue, 19 Nov 2019 09:10:19 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Sl1Nwrf0cRtZbfOP/Enq9tl51ywUiVzcNdk1c0Uc3KKGgy1p/Mqv2/EV1/yrafZ6EXXK4X3hfUwu36PZSkYjlEejNas3oNGDgxy4mE5LattPkmjXY33ZMXUUtRpqXM77vk2ng/Lz2QZgOZBYsOaN/ZocVqcM8b0SSegP874iGgu6YqxgXXDWOzcJ8Xr8H7HJ8dNvavUirxVSYn6qPm4SWTWpeQTPxgeoMUeMkNaAbroVD7ngDC8h9pLqAY9JPxhTyUxGJUMKvzbtIU+ywoVsnJQK5tKG1x8Te2lH4kQsTDcFBpb7UrTzpnSvMj8/2V3MuWUZqQogbFKiadR2I0839A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=SdqAZdh5U6sOBgDkyVbY7DpGtb3eXsXXJFDNqcmuy34=; b=XlmUQBqZPEJZIQZ4cUrcr7P+JHpDtEZW5ycVH+MHulsEOYf+QGjJffPVQbQOE6Q+uw0XCcadaitxgSsvF8HhHdThwvODJseJ88teDcF7YCsMXdhaO7jgIGbaCiIE+q5sS2Fnzg2Bn2DCjmU0mzchNee/BkAiI+f7W1Ex1AX7gWbRSfMcV/o7p73Ujd7zgqagTZJZPr0PnMK8AH6yXNnE7tRZbZCIv2JfmWb1tz6kRHDI7RLbvxel2QUePBRb1I0Ran4YJhz/0ZruGn8+AtlwG7mGAshlssSQMcYGy/Us0Jmvq9FhnnO72Oj4Y0ZbF33bDomA6JQZ84HLtH9+BxcTug== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none (sender ip is 165.204.84.17) smtp.rcpttodomain=google.com smtp.mailfrom=amd.com; dmarc=permerror action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector2-amdcloud-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=SdqAZdh5U6sOBgDkyVbY7DpGtb3eXsXXJFDNqcmuy34=; b=nwl+Ckqo8ArL3nldYso6M1jtVCc5xFgMMpX+oKA/eMalB5nY6SdGPpD44XPXJGB5UYf56oaeDqlMUr7//Dx9dVRYVrzm6gHnlZYMdINokRL5VaQ9iVaoxS36Jxxy6FWz01wT4rHTc/JIlBH6jdyzycmEB+5Pb3qEMGau5ZvRqkI= Received: from DM3PR12CA0069.namprd12.prod.outlook.com (2603:10b6:0:57::13) by DM6PR12MB3097.namprd12.prod.outlook.com (2603:10b6:5:11d::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2451.23; Tue, 19 Nov 2019 14:10:17 +0000 Received: from DM6NAM11FT032.eop-nam11.prod.protection.outlook.com (2a01:111:f400:7eaa::202) by DM3PR12CA0069.outlook.office365.com (2603:10b6:0:57::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2474.16 via Frontend Transport; Tue, 19 Nov 2019 14:10:17 +0000 Authentication-Results: spf=none (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; google.com; dkim=none (message not signed) header.d=none;google.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 SATLEXMB01.amd.com (165.204.84.17) by DM6NAM11FT032.mail.protection.outlook.com (10.13.173.93) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.2451.23 via Frontend Transport; Tue, 19 Nov 2019 14:10:17 +0000 Received: from SATLEXMB05.amd.com (10.181.40.146) by SATLEXMB01.amd.com (10.181.40.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Tue, 19 Nov 2019 08:10:08 -0600 Received: from SATLEXMB02.amd.com (10.181.40.143) by SATLEXMB05.amd.com (10.181.40.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Tue, 19 Nov 2019 08:10:08 -0600 Received: from vishnu-All-Series.amd.com (10.180.168.240) by SATLEXMB02.amd.com (10.181.40.143) with Microsoft SMTP Server id 15.1.1713.5 via Frontend Transport; Tue, 19 Nov 2019 08:10:05 -0600 From: Ravulapati Vishnu vardhan rao CC: , , , Ravulapati Vishnu vardhan rao , Liam Girdwood , Mark Brown , Jaroslav Kysela , "Takashi Iwai" , "moderated list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEM..." , open list Subject: [PATCH v10 4/6] ASoC: amd: add ACP3x TDM mode support Date: Tue, 19 Nov 2019 19:38:26 +0530 Message-ID: <1574172508-26546-5-git-send-email-Vishnuvardhanrao.Ravulapati@amd.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1574172508-26546-1-git-send-email-Vishnuvardhanrao.Ravulapati@amd.com> References: <1574172508-26546-1-git-send-email-Vishnuvardhanrao.Ravulapati@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)(4636009)(346002)(39860400002)(136003)(396003)(376002)(428003)(189003)(199004)(86362001)(51416003)(26005)(5660300002)(53416004)(2616005)(47776003)(81166006)(8676002)(336012)(81156014)(486006)(305945005)(8936002)(6666004)(356004)(126002)(50226002)(426003)(11346002)(446003)(186003)(316002)(476003)(478600001)(50466002)(16586007)(4326008)(70206006)(109986005)(36756003)(70586007)(2906002)(7696005)(48376002)(76176011)(1671002)(54906003)(266003)(32563001);DIR:OUT;SFP:1101;SCL:1;SRVR:DM6PR12MB3097;H:SATLEXMB01.amd.com;FPR:;SPF:None;LANG:en;PTR:InfoDomainNonexistent;MX:1;A:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1920fe37-cbcd-412d-71d1-08d76cfa345b X-MS-TrafficTypeDiagnostic: DM6PR12MB3097: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2512; X-Forefront-PRVS: 022649CC2C X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: BPOZYGOQLqrywiSEvcizxHCyMwuayDFz417uN2X3iz4bG0VwH7qt5yePPm8YAIlu1ihjVg7EI/5a/Mh4LJ+mi8HAG3buvofHHzy6oEX9uhEsOjG0oAqjrZwGaIgMdmVScD9imJ7Id0JHniXystH85iDQBG9auvsXaaUyFf/Dvc2UsCbMd89G8IU5yR5Lg8He8aXVJLkO55IhIcb4UcDKlh7iq+J0YU8hEyh9yfeGQ6FtxX99WeBoJcq/Vo1tP2VGh4PR9Rp2MrqH8CxoNxUAX1L9hLzlN2Gs1RxtXFHfz4MXI73q/LCAGgsBK79TOISHhzFxlsTI53/v6XxOHFz4Sd+k1eNaHxdyXCe+aD9vyvVgey5OWDpiBROGjCkvj7YBg5BvN6+XU6DZff5Htj1tdVMiXFDNmOCInpUSTfvUP2U0RI9YgEKyYoBdU8PMvaBD X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Nov 2019 14:10:17.1405 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1920fe37-cbcd-412d-71d1-08d76cfa345b 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=[SATLEXMB01.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB3097 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 I2S (CPU DAI) can act in normal I2S and TDM modes. Added support for TDM mode. Desired mode can be selected from ASoC machine driver. Signed-off-by: Ravulapati Vishnu vardhan rao --- sound/soc/amd/raven/acp3x-i2s.c | 42 +++++++++++++++++++++++++++++++---------- sound/soc/amd/raven/acp3x.h | 2 ++ 2 files changed, 34 insertions(+), 10 deletions(-) diff --git a/sound/soc/amd/raven/acp3x-i2s.c b/sound/soc/amd/raven/acp3x-i2s.c index b039dac..d7aa345 100644 --- a/sound/soc/amd/raven/acp3x-i2s.c +++ b/sound/soc/amd/raven/acp3x-i2s.c @@ -44,8 +44,8 @@ static int acp3x_i2s_set_tdm_slot(struct snd_soc_dai *cpu_dai, u32 tx_mask, u32 rx_mask, int slots, int slot_width) { struct i2s_dev_data *adata; - u32 val; u16 slot_len; + u32 val, flen, reg_val, frmt_reg; adata = snd_soc_dai_get_drvdata(cpu_dai); @@ -68,16 +68,38 @@ static int acp3x_i2s_set_tdm_slot(struct snd_soc_dai *cpu_dai, u32 tx_mask, return -EINVAL; } - val = rv_readl(adata->acp3x_base + mmACP_BTTDM_ITER); - rv_writel(val | 0x2, adata->acp3x_base + mmACP_BTTDM_ITER); - val = rv_readl(adata->acp3x_base + mmACP_BTTDM_IRER); - rv_writel(val | 0x2, adata->acp3x_base + mmACP_BTTDM_IRER); - - val = FRM_LEN | (slots << 15) | (slot_len << 18); - rv_writel(val, adata->acp3x_base + mmACP_BTTDM_TXFRMT); - rv_writel(val, adata->acp3x_base + mmACP_BTTDM_RXFRMT); + /* Enable I2S / BT channels TDM and respective + * I2S/BT`s TX/RX Formats frame lengths. + */ + flen = FRM_LEN | (slots << 15) | (slot_len << 18); - adata->tdm_fmt = val; + if (adata->substream_type == SNDRV_PCM_STREAM_PLAYBACK) { + switch (adata->i2s_instance) { + case I2S_BT_INSTANCE: + reg_val = mmACP_BTTDM_ITER; + frmt_reg = mmACP_BTTDM_TXFRMT; + break; + case I2S_SP_INSTANCE: + default: + reg_val = mmACP_I2STDM_ITER; + frmt_reg = mmACP_I2STDM_TXFRMT; + } + } else { + switch (adata->i2s_instance) { + case I2S_BT_INSTANCE: + reg_val = mmACP_BTTDM_IRER; + frmt_reg = mmACP_BTTDM_RXFRMT; + break; + case I2S_SP_INSTANCE: + default: + reg_val = mmACP_I2STDM_IRER; + frmt_reg = mmACP_I2STDM_RXFRMT; + } + } + val = rv_readl(adata->acp3x_base + reg_val); + rv_writel(val | 0x2, adata->acp3x_base + reg_val); + rv_writel(flen, adata->acp3x_base + frmt_reg); + adata->tdm_fmt = flen; return 0; } diff --git a/sound/soc/amd/raven/acp3x.h b/sound/soc/amd/raven/acp3x.h index c071477..01b283a 100644 --- a/sound/soc/amd/raven/acp3x.h +++ b/sound/soc/amd/raven/acp3x.h @@ -76,6 +76,8 @@ struct i2s_dev_data { bool tdm_mode; unsigned int i2s_irq; u32 tdm_fmt; + u16 i2s_instance; + u32 substream_type; void __iomem *acp3x_base; struct snd_pcm_substream *play_stream; struct snd_pcm_substream *capture_stream; -- 2.7.4