From patchwork Tue Nov 19 09:32:45 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: 11251613 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 B53FC6C1 for ; Tue, 19 Nov 2019 09:37:45 +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 44C482230C for ; Tue, 19 Nov 2019 09:37:45 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="JbzG2bI/"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=amdcloud.onmicrosoft.com header.i=@amdcloud.onmicrosoft.com header.b="JOjjGFNm" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 44C482230C 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 77C4A1696; Tue, 19 Nov 2019 10:36:53 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 77C4A1696 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1574156263; bh=ddzDNDjVo3TAE8xu3poN82lG/Mx0C9Pelp2p+i33dKA=; h=From:To:Date:In-Reply-To:References:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=JbzG2bI/dHPPArR5SE6+Urf/wtactgQhy2NA3YJqLh2kJs8Dr81fSOudjjjaKFR8n NoxNRuOR3HXRaxGQQZ1sOwhjO2Ycnjj5hUh9vs6Znzug7iqEVr0JmzDB6WqaVLXkVG 83eWwauotZi7ZE99jBet6xt2yx5zPwd1S3yUFfrM= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 52C0AF8015E; Tue, 19 Nov 2019 10:34:47 +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 61CE3F8015D; Tue, 19 Nov 2019 10:34:46 +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,SURBL_BLOCKED,URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from NAM01-SN1-obe.outbound.protection.outlook.com (mail-eopbgr820087.outbound.protection.outlook.com [40.107.82.87]) (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 43EDFF8015D for ; Tue, 19 Nov 2019 10:34:42 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 43EDFF8015D Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=amdcloud.onmicrosoft.com header.i=@amdcloud.onmicrosoft.com header.b="JOjjGFNm" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Pc1VdYe817TS0ed6wuOAV/PJgHACS1RM2VxYzvx5MaWhZjDYJWzuCf9uj/wQd3aUDtM5qR0GdWxM5bur/eYf2pEbqlGB6MzpMhvtx+l5/8P7EO3oHmh5MoX+4Jsdwy/FRUUKZ84waOPIxQOUdXLmP6Z22bE+uUl9OPrQ+hxP+8OT5BsI0R+zW97uznrl2uLwOKEBtpL5A1ANNm11brq45IOwb3BVeooQYrISeFv6jDjdMzRCSm7kxjsVnzXWALIrSYk4P7E3sTViHkHMWGejHKLqkLsRwoHgT68+3qAbmd1VmIjMc/6gTkIz2DGeyS8mQl8jqDnmpG3ulRKsQTLn0w== 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=FZlv4Y+2Z94pkuPHSNNtiL+r1eYrxmR4ZB2Dh54oRWPR/nNBqFIMQa8mnYdIPbsuf32s3AGMNMgkicItEpmneVu7DHs9qPNy/c0/TmRxyjVrh/nDp4wqoqgCGFLy9hs8gEQ4hALv53L4pE2XYujFuXmZNw1quqDUUkreQqAqbJ8piHTm5kmJBF37k8Q2i5K59VnjpPbF1z5gnjtxtqEBEkxgjQobYlWf7QYNZ3ZkL/OQ9kU2f1vw3jfnI/ZFnG7Lcx+X1BuH0r4wpbwjQkIdKOZKfVKTBjPfi+5Xm6QmLpcF1fvqxhnqxDjZmf8HfGq5N77IhBGB1gt6WEGUERNAxQ== 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=JOjjGFNmOnlTc5i8fz9J4J9mAcM5akYAh1IEkM41o66oznoAvji3rJShxM41jbK6auG0LiZtl5Ujn2t5V6aZQNjq+TcMJBVHpmwyW8BK5HZ6hUVi7JtsiWng/Eagblf4DtJHWJC2hPHXsmM726ag5L+cld1FldkD6ZmSajhWxsg= Received: from MWHPR12CA0061.namprd12.prod.outlook.com (2603:10b6:300:103::23) by BYAPR12MB3144.namprd12.prod.outlook.com (2603:10b6:a03:d6::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2474.16; Tue, 19 Nov 2019 09:34:39 +0000 Received: from CO1NAM11FT018.eop-nam11.prod.protection.outlook.com (2a01:111:f400:7eab::208) by MWHPR12CA0061.outlook.office365.com (2603:10b6:300:103::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2451.23 via Frontend Transport; Tue, 19 Nov 2019 09:34:39 +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 CO1NAM11FT018.mail.protection.outlook.com (10.13.175.16) 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 09:34:38 +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 03:34:38 -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 03:34:37 -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 03:34:35 -0600 From: Ravulapati Vishnu vardhan rao To: Date: Tue, 19 Nov 2019 15:02:45 +0530 Message-ID: <1574155967-1315-5-git-send-email-Vishnuvardhanrao.Ravulapati@amd.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1574155967-1315-1-git-send-email-Vishnuvardhanrao.Ravulapati@amd.com> References: <1574155967-1315-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)(136003)(346002)(39860400002)(396003)(376002)(428003)(189003)(199004)(26005)(53416004)(4326008)(8676002)(50226002)(36756003)(109986005)(186003)(81156014)(5660300002)(8936002)(16586007)(316002)(305945005)(47776003)(6666004)(356004)(86362001)(126002)(476003)(50466002)(336012)(486006)(81166006)(478600001)(70206006)(11346002)(70586007)(2906002)(54906003)(1671002)(76176011)(446003)(426003)(2616005)(48376002)(7696005)(51416003)(266003)(32563001); DIR:OUT; SFP:1101; SCL:1; SRVR:BYAPR12MB3144; 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: af779e1b-4355-4f86-dbfc-08d76cd3b2dc X-MS-TrafficTypeDiagnostic: BYAPR12MB3144: 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: g6hhr5GcYaBh6ghDXT6/BxvKo4ffQ4oJ6v25/GJUZuKDxIMZc0qM2RF/apwFG8Dgea4CYlxuVcPeqbTINWHWSxuZN2u/dXwi4EHhMUampHhOlZyf6GIKQ5M7JbNDqSp2t7ItT0uLFS9nlSXw4LDg77UrIQ9j5QUc8yfeAqJts5BBBnK0tklp6V5lgYnD6zJU3U5v0Ba53u/LdXLZOwpLZRTcZr76f8CBhBuzFuOXVaageQQ8bSJSBU6Ub4SYzGiiJfzusCofuM6WmVdsElsoJ2GvVeIP0+8wjRUVjIa1DD9nPTUvRU68ceTwTnF5angjPjN21NEzRn0qNAQny/VT+/8MGs0k6hlZZRY7/1Z2iQgkgbFsFhAsEgem7X5LjqkXhOWshehqciM0riptkMNgYfzypE58vDXi15KJj4MGMJF8nSFI7xaWi5FBaf5/MslB X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Nov 2019 09:34:38.9231 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: af779e1b-4355-4f86-dbfc-08d76cd3b2dc 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: BYAPR12MB3144 Cc: "moderated list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEM..." , open list , Takashi Iwai , Liam Girdwood , Akshu.Agrawal@amd.com, Ravulapati Vishnu vardhan rao , Mark Brown , djkurtz@google.com, Alexander.Deucher@amd.com Subject: [alsa-devel] [PATCH v8 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 | 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;