From patchwork Wed Nov 13 07:14:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "RAVULAPATI, VISHNU VARDHAN RAO" X-Patchwork-Id: 11241201 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DDC8914E5 for ; Wed, 13 Nov 2019 07:19:04 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6E2B521D7F for ; Wed, 13 Nov 2019 07:19:04 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="WrHTvgEV"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=amdcloud.onmicrosoft.com header.i=@amdcloud.onmicrosoft.com header.b="lJZvsdOv" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6E2B521D7F Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 964CE3E; Wed, 13 Nov 2019 08:18:12 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 964CE3E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1573629542; bh=D98YfFAsH/7kFij6EFoeW4ntPTBhxvQDwKTFsbhzHgY=; h=From:To:Date:In-Reply-To:References:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=WrHTvgEVGrEHvfuvA8HRn7T3GX+J1rpzO5/xvRpwCvRHtVAUKHCydghVl+oF8CUry Z8pQ7p6C4BPuRhPfSS3EDGYwwJuUHRbT/v+wrt2SItXDu6K6do7TlspUIT2tYCtWMz VhzhuCZYI7vTEeG+3OXgVCDKdguJOjm7tbHCLek8= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id B608EF80642; Wed, 13 Nov 2019 08:16:14 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa1.perex.cz (Postfix, from userid 50401) id E4A36F80649; Wed, 13 Nov 2019 08:16:13 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on alsa1.perex.cz X-Spam-Level: * X-Spam-Status: No, score=1.0 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, FORGED_SPF_HELO,SPF_HELO_PASS,SPF_NONE autolearn=disabled version=3.4.0 Received: from NAM02-BL2-obe.outbound.protection.outlook.com (mail-eopbgr750042.outbound.protection.outlook.com [40.107.75.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id DECBBF8063B for ; Wed, 13 Nov 2019 08:16:10 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz DECBBF8063B Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=amdcloud.onmicrosoft.com header.i=@amdcloud.onmicrosoft.com header.b="lJZvsdOv" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fwSo1lKWdkmWzQVhAfWFbaWO4TXqT6QsSU72rBcF5JoNbWSRUK/kmCVRZDRqc3reHAJnwAyhaxdfcYI5FHQ7CvsUk+FU5O/d75kqdE2u2dWkSHzoG56XQIkXEqm1gg9/gq84XId+sHB6ED/IAsJWHkzOcwDNhbX43WgqK10wQhodNucPW91A5CUjUN2xtHCgiYj1bb8SE/USo5WL6dm4lrvHXyL8ej/Su5yP7IWL2Ys/SdoUwBCgxY9HJsz4wWGP/yaP5Goie+PG84J702UOeLnIKSlMNrFXxBB4JwKf+3i41PFCbNISMSWspm4vxrSCTRBJdfZp9T4/73AJuNx3cQ== 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=PLPIAKLEjVonlAaHkIJsqjB82FIYgfUPiLNRgE+lJ80=; b=j8nKNl6JjH4n82jImZ0Skf4b9ch/mbU2oU4fz0zqpIDFTqQgUP3nGu5jd9pGNsgpVg9NgjdbXMGu+TqB/MRSBn68LvEOrzynVDgNJKn2Mn0s2f4wVUTqeNou5/mKo7qUcG0V+AOETW7rdKgyJyOhL9QOwrMRZgdQ6vvGNhbmM99i+yHw5oexVotszthQlnjkfuZLwP7tVxbdHVJoMq3bkLrCJA87Y+kHi5Fwx4HMjEJvrpt8YnSMZQ8cytutw2Br47D2FgtTaPaHMIeavQG6MgWX3ZkGW8UtKeVcTIkNAQDcDeGSVO3rWiX1tHR5n8vqi5OKkPo6KNTRtDTZ8bZ7AA== 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=PLPIAKLEjVonlAaHkIJsqjB82FIYgfUPiLNRgE+lJ80=; b=lJZvsdOvYiEkKCxWjfbv6EdRCTLDJrjRk3t2Lwrf3rMYF2N845jMO7BNYuwOb4GBQ++VFArSLozkLvxWSCZkra4tBI8GKL31OSOFQPsL9U1bVGuHbpZ+5nZefywnHv+/rcZQxBbMSvWDm/ajlTjemCMY2Wj9Zwar6H4nk4M6+x0= Received: from MWHPR12CA0042.namprd12.prod.outlook.com (2603:10b6:301:2::28) by BYAPR12MB3381.namprd12.prod.outlook.com (2603:10b6:a03:df::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2451.23; Wed, 13 Nov 2019 07:16:06 +0000 Received: from BN8NAM11FT055.eop-nam11.prod.protection.outlook.com (2a01:111:f400:7eae::203) by MWHPR12CA0042.outlook.office365.com (2603:10b6:301:2::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2451.22 via Frontend Transport; Wed, 13 Nov 2019 07:16:06 +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 SATLEXMB02.amd.com (165.204.84.17) by BN8NAM11FT055.mail.protection.outlook.com (10.13.177.62) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.2451.23 via Frontend Transport; Wed, 13 Nov 2019 07:16:06 +0000 Received: from SATLEXMB02.amd.com (10.181.40.143) by SATLEXMB02.amd.com (10.181.40.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Wed, 13 Nov 2019 01:16:03 -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; Wed, 13 Nov 2019 01:15:55 -0600 From: Ravulapati Vishnu vardhan rao To: Date: Wed, 13 Nov 2019 12:44:07 +0530 Message-ID: <1573629249-13272-5-git-send-email-Vishnuvardhanrao.Ravulapati@amd.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1573629249-13272-1-git-send-email-Vishnuvardhanrao.Ravulapati@amd.com> References: <1573629249-13272-1-git-send-email-Vishnuvardhanrao.Ravulapati@amd.com> MIME-Version: 1.0 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)(396003)(346002)(39860400002)(376002)(136003)(428003)(189003)(199004)(50466002)(109986005)(16586007)(54906003)(36756003)(316002)(86362001)(4326008)(7696005)(76176011)(186003)(6666004)(356004)(48376002)(2906002)(26005)(47776003)(51416003)(1671002)(426003)(70206006)(336012)(478600001)(305945005)(11346002)(50226002)(70586007)(446003)(8936002)(2616005)(476003)(126002)(81156014)(486006)(81166006)(8676002)(53416004)(5660300002)(266003)(32563001); DIR:OUT; SFP:1101; SCL:1; SRVR:BYAPR12MB3381; H:SATLEXMB02.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoDomainNonexistent; MX:1; A:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 93fd3715-d4b0-4473-c5f9-08d768095976 X-MS-TrafficTypeDiagnostic: BYAPR12MB3381: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2512; X-Forefront-PRVS: 0220D4B98D X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: XDFFO/gRjX53sJxVckYh8kuemZvxB+sQHbWRsxWohrulhzwwiYCk5QvGNivbnRjS12qCWevo3XselxFLrDGTAWU+D3q2j36bwGnFwFfeb7McJ0lTAVEWTlslNS1azFmzvuM7BEtNTREQShgtG1JXGls9TILiKUFKOft5LwQSySQ/et2l1C47nbijZeux3xM5kP9pEDwUNJP0Ik2v9Kw8kCN9zbaNDbwZOuEXJM8kOA3mfmkKfZSAfFmuuMgMIfBWFoEMGavHMa3CSbc0TUcAYcK+ZJjgwysgcEt9v+PhS2abgj2AZrx2mfniMRy+0cM43/O9e0kqyYds6dsylfrD+MZFwVjs8NMQs31arstrxrFXIzqcSq3BmG9dYNzyj+5g2BeWjmCiR67cEjMhPvNh9kcLMOxtwFP3NAmoAymJNyuagEi51RVy4Rzit1UxHS5O X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Nov 2019 07:16:06.0714 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 93fd3715-d4b0-4473-c5f9-08d768095976 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=[SATLEXMB02.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR12MB3381 Cc: "moderated list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEM..." , Maruthi Srinivas Bayyavarapu , open list , Takashi Iwai , Liam Girdwood , Akshu.Agrawal@amd.com, Ravulapati Vishnu vardhan rao , Mark Brown , djkurtz@google.com, Vijendar Mukunda , Alex Deucher Subject: [alsa-devel] [RESEND PATCH v5 4/6] ASoC: amd: add ACP3x TDM mode support X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" 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 | 51 +++++++++++++++++++++++++++++++++-------- sound/soc/amd/raven/acp3x.h | 2 ++ 2 files changed, 43 insertions(+), 10 deletions(-) diff --git a/sound/soc/amd/raven/acp3x-i2s.c b/sound/soc/amd/raven/acp3x-i2s.c index bd0ec68..f6b306d 100644 --- a/sound/soc/amd/raven/acp3x-i2s.c +++ b/sound/soc/amd/raven/acp3x-i2s.c @@ -43,7 +43,7 @@ static int acp3x_i2s_set_tdm_slot(struct snd_soc_dai *cpu_dai, u32 tx_mask, u32 rx_mask, int slots, int slot_width) { u32 val; - u16 slot_len; + u16 slot_len, flen; struct i2s_dev_data *adata = snd_soc_dai_get_drvdata(cpu_dai); @@ -66,16 +66,47 @@ 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); + /* Enable I2S / BT channels TDM and respective + * I2S/BT`s TX/RX Formats frame lengths. + */ + flen = (FRM_LEN | (slots << 15) | (slot_len << 18)); - 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); - - adata->tdm_fmt = val; + if (adata->substream_type == SNDRV_PCM_STREAM_PLAYBACK) { + switch (adata->i2s_instance) { + case I2S_BT_INSTANCE: + val = rv_readl(adata->acp3x_base + mmACP_BTTDM_ITER); + rv_writel((val | 0x2), + adata->acp3x_base + mmACP_BTTDM_ITER); + rv_writel(flen, + adata->acp3x_base + mmACP_BTTDM_TXFRMT); + break; + case I2S_SP_INSTANCE: + default: + val = rv_readl(adata->acp3x_base + mmACP_I2STDM_ITER); + rv_writel((val | 0x2), + adata->acp3x_base + mmACP_I2STDM_ITER); + rv_writel(flen, + adata->acp3x_base + mmACP_I2STDM_TXFRMT); + } + } else { + switch (adata->i2s_instance) { + case I2S_BT_INSTANCE: + val = rv_readl(adata->acp3x_base + mmACP_BTTDM_IRER); + rv_writel((val | 0x2), + adata->acp3x_base + mmACP_BTTDM_IRER); + rv_writel(flen, + adata->acp3x_base + mmACP_BTTDM_RXFRMT); + break; + case I2S_SP_INSTANCE: + default: + val = rv_readl(adata->acp3x_base + mmACP_I2STDM_IRER); + rv_writel((val | 0x2), + adata->acp3x_base + mmACP_I2STDM_IRER); + rv_writel(flen, + adata->acp3x_base + mmACP_I2STDM_RXFRMT); + } + } + 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;