From patchwork Fri Mar 19 19:13:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Morgan X-Patchwork-Id: 12151767 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.1 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FORGED_HOTMAIL_RCVD2,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, UNWANTED_LANGUAGE_BODY,UPPERCASE_50_75,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 264DFC433DB for ; Fri, 19 Mar 2021 19:16:03 +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 F07056197D for ; Fri, 19 Mar 2021 19:16:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F07056197D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=hotmail.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 18F20167F; Fri, 19 Mar 2021 20:15:10 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 18F20167F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1616181360; bh=Upa8xkuEcUdgO+bzqPJezNXNEPhwH9cUBbb0mKoxmbM=; h=From:To:Subject:Date:Cc:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From; b=q9TKjbllFBkvyu3fNXhaLdjpoLMOXPyLRW9X1wX0S7nS49kDyw/I1xp/OfMdEwdVY 0D+B7yal86o2MmZCu5fiUZxXVDeKpoiXg5R/MlIEBK96UKIgmRluct6HDW1iJgjU3M Qb0Pmz39GWA76RmhokQr9RbHC7oDY+XSUPZus90Y= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id C6864F802CA; Fri, 19 Mar 2021 20:14:20 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id C2DC6F800BB; Fri, 19 Mar 2021 20:14:19 +0100 (CET) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12olkn2070.outbound.protection.outlook.com [40.92.22.70]) (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 5B557F800BB for ; Fri, 19 Mar 2021 20:14:07 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 5B557F800BB Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=hotmail.com header.i=@hotmail.com header.b="gdqhD9dK" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YJkuB1S+o1zBuvGfb2JKGgWGXl5LVTVdpBMV7nxfTBJKJ3/NfsfSdkxTQIRnptseipSScQwkxoH0tGGxg3JldVO/xUi5whCa4WIGzu7Y6x9u5rb0t9wTvmReKhm4tUfKWw8y4kOSm6B+f/LDD9v1vjpydC5UJaxw+ubXtYBZR2+ktYNjj+uYKLHx8hgi7ZVPatiliGXkmnAuz3eBSh2qL+P4C2cG8rGWFvbz691sBGBMq7nGqN+BUDIlKDHUBjhi4VJtpUUZ5pWR4F/vxjlCP+IOaS2akp3FLmCMhy2Mt1V9Xx3+AhfKSLr9DHsG4ZjYJWwmRC4gR2INCHNMC5DbxA== 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=PclFFJizvl89I+uhovAwAG2HrugwfyZ7fK9TdzVP4G4=; b=adNvM9SMfUC3c27LlPDX0iU9uQUKOlCBg5wyS9hBgf+ffwbPT7tRwR3ZXCRC80OMBDNFGdOFVNcV/RKHHI7fZyGHzMnbzqVUeCZCNKuXgExiJrcmn0Xow8hfBoioDwfBLbqIvHIvC4XOfku4KQkzvJMjeJn0fomlOMdonfCghoPqKJOQ83evhjbCREUA135/9UJjJIIFu29Yvoa3oee5ngdEZbuDaYaV07JDDva7o6NuJFzdxPdOBdxwg68VfZQpSBTTHXRsrZ2YGhe17MWYS51q/4e6i9sBcNuVljpmoGC2DnQZaQZw3L154N9FLA7vV9q/NSEb2j62tp4m+0eLeA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hotmail.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=PclFFJizvl89I+uhovAwAG2HrugwfyZ7fK9TdzVP4G4=; b=gdqhD9dKFrLykuZOdkdCuu/9Jr96v701Foj1zV0JXYX/5644QrO68w1KXSqcxZhmhQpTJLCre5CcO3BQXFko2IiSH4Fg5QgCpFpAVtgemrjktlkrSS9/3Ftno+/VLqcttK++F5i6ehjBHx7y/VpuLzWjWrMxTaBu0YSJncQAhUPnLvMqJXvvzwnrnX+Wlm/jfLEZqoHWWnSKr/3g5qoCHIo2M4KWSxXbScN2q/DTxPk2BZHkpld7tfhKSAebVKnPgZIQnGKxSIgNTrO9fV/lz8ZKjSgcmSH3ZTgjJZpdEqB1/HE2/KZHufg2Ojt1aIxVYK6UvE9XAICGU6ap9/c7rA== Received: from BN8NAM12FT062.eop-nam12.prod.protection.outlook.com (2a01:111:e400:fc66::41) by BN8NAM12HT048.eop-nam12.prod.protection.outlook.com (2a01:111:e400:fc66::304) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3955.9; Fri, 19 Mar 2021 19:13:55 +0000 Received: from SN6PR06MB5342.namprd06.prod.outlook.com (2a01:111:e400:fc66::53) by BN8NAM12FT062.mail.protection.outlook.com (2a01:111:e400:fc66::321) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3955.9 via Frontend Transport; Fri, 19 Mar 2021 19:13:55 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:43A34AC0507850892914D4D8127524594948569CD068CBC185E86342265D9D9A; UpperCasedChecksum:4C72A9C8D67D99165ECC44552078B9D4445DEC238987D1C0C0D6FD8AC6C31193; SizeAsReceived:7402; Count:45 Received: from SN6PR06MB5342.namprd06.prod.outlook.com ([fe80::fc38:a692:c2c8:f63e]) by SN6PR06MB5342.namprd06.prod.outlook.com ([fe80::fc38:a692:c2c8:f63e%7]) with mapi id 15.20.3955.018; Fri, 19 Mar 2021 19:13:55 +0000 From: Chris Morgan To: alsa-devel@alsa-project.org Subject: [PATCH v5 1/4] mfd: Add Rockchip rk817 audio CODEC support Date: Fri, 19 Mar 2021 14:13:34 -0500 Message-ID: X-Mailer: git-send-email 2.25.1 X-TMN: [brBSG+GdC8L/0AwOmszEomwwMxlNCEi3] X-ClientProxiedBy: SN1PR12CA0044.namprd12.prod.outlook.com (2603:10b6:802:20::15) To SN6PR06MB5342.namprd06.prod.outlook.com (2603:10b6:805:f9::31) X-Microsoft-Original-Message-ID: <20210319191337.9414-1-macromorgan@hotmail.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from wintermute.localdomain (76.183.134.35) by SN1PR12CA0044.namprd12.prod.outlook.com (2603:10b6:802:20::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3955.18 via Frontend Transport; Fri, 19 Mar 2021 19:13:54 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 45 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: 69493a0a-33d2-48ce-0018-08d8eb0b2376 X-MS-Exchange-SLBlob-MailProps: mBy7Mai7yE7CRTBaMPdSvo2GfMG4mSdlUA9MwktO30GraT6pW5dXbUlp2j1rr8zQnRpXqYbZxgjgByZxnYE2I4eNg4tx1xYjyaCCADHDA59LVYnZMRQJzpvASs7HzA2ld5oAx9XdJqPwhLj/w+ZMVpdL/CD2c9VvJmNaf2Yc2lWDI9gdn4dh0tSXvFPgkec+fz300XI1WOkv2N2HtsezfFDew+njhDkuZ62aYz3FnSa1Th73IyIAZmD6GwX5HTY5IpnJJC+ZgMAcKtGLzRgNEQjt3XA9HpkcfEdeLCOPj2xh3VQ7Y2l0cUVglHf9fU8CCD/646l7nUAJBAbipdMRzShp11ADYP4wvMdLeUuKHpcenmjhLJ0pXoyYXpiuIS2umb8PJVHO7kjv5fbWgBsSarxbDmgGsQLgE5fBp7DrmInYb093xTw3iu1InNeVOy0P4uX1tE62n7WWrU2XsUuJ5Supr2muzMZe8eSqXH/ib6hZ4UpAS+SvNxpK3wd+9oPrflpe8r03r0qwd+Bm5cjkQnxoo4DNql6qgTBqIqKqc7N5AhuIzyVt4xhG9/AkBHTe6WJ8FDLrLXnO06HT6RNvJ7Z0ZL+D1w5EYRrF9slqQXeflHTu7Y+QUbbGGGHOjmUQCHmB0hyinkHokFmmR+C1sZ0FZmRh/Fp53/VR3MHwG5nxeMiLC1i7ZCyv6d1bjcxqNeGiH5RbnsPSyj5tikKUg5NAnj/7dbA6 X-MS-TrafficTypeDiagnostic: BN8NAM12HT048: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: i93/pDHU/k7XOL2sV+ASZ0QVY7nRn8UooHf0wMSOE6k2sT4Cr9nKzhH2ySiTsFb4whuD6V33XCW0FLogTQc4vj6ZsQv2YqOJfhPaCkaiTAnZuY8dX9DkGFWeIaTSogYQ7y51Sl5/i+9SywZCE9nRS0LdcH7wbynk0dZp0Of/jAJZyIINrA2/wJ2D+6WHn957weafHWkRCaQqnOIdkl+71Wm5EkkNfD/wgqFD4BP4s+Gq+ZbpV0ydzLBKnmwkaiYV51JE+3P/Ts0jtHdzQjC13SJyXGsKr6NFAHyHhOhxGpzExA1jiShR8p94DRtVCdcOX7XBP6bc7dSqQeiDkH8VKQL4Zwfi/Mk5qrWl/wNYQ0NIxDdGzPtIgJCClgD8u0BF/jAdYaAVOURavqEXr/VJTQ== X-MS-Exchange-AntiSpam-MessageData: 9TNtIDrkmZckdNbq2OQuWeFawme3MLgeWbu/LTuMojBWsZbzIyrfBjyse+O+LPFxxjRYMyNJDuNOOW6N7GMjlODxV3wOVkkPnjOqE+H6ne3GP4yDuBZ4UU5zOGcjOWxragzpIFJ1JmgLXaz1k3FjIA== X-OriginatorOrg: hotmail.com X-MS-Exchange-CrossTenant-Network-Message-Id: 69493a0a-33d2-48ce-0018-08d8eb0b2376 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Mar 2021 19:13:55.5232 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-AuthSource: BN8NAM12FT062.eop-nam12.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: Internet X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN8NAM12HT048 Cc: broonie@kernel.org, heiko@sntech.de, pierre-louis.bossart@linux.intel.com, Chris Morgan , tiwai@suse.com 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" Add rk817 codec support cell to rk808 mfd driver. Changes from v4: Move register definitions from rk817_codec.h to main rk808.h register definitions. Add volatile register for codec bits. Add default values for codec bits. Removed of_compatible. Signed-off-by: Chris Morgan --- drivers/mfd/rk808.c | 89 +++++++++++++++++++++++++++++++++++++++ include/linux/mfd/rk808.h | 81 +++++++++++++++++++++++++++++++++++ 2 files changed, 170 insertions(+) diff --git a/drivers/mfd/rk808.c b/drivers/mfd/rk808.c index ad923dd4e007..b92f4c6f503e 100644 --- a/drivers/mfd/rk808.c +++ b/drivers/mfd/rk808.c @@ -65,6 +65,9 @@ static bool rk817_is_volatile_reg(struct device *dev, unsigned int reg) switch (reg) { case RK817_SECONDS_REG ... RK817_WEEKS_REG: case RK817_RTC_STATUS_REG: +#ifdef CONFIG_SND_SOC_RK817 + case RK817_CODEC_DTOP_LPT_SRST: +#endif case RK817_INT_STS_REG0: case RK817_INT_STS_REG1: case RK817_INT_STS_REG2: @@ -163,6 +166,11 @@ static const struct mfd_cell rk817s[] = { .num_resources = ARRAY_SIZE(rk817_rtc_resources), .resources = &rk817_rtc_resources[0], }, +#ifdef CONFIG_SND_SOC_RK817 + { + .name = "rk817-codec", + }, +#endif }; static const struct mfd_cell rk818s[] = { @@ -201,6 +209,87 @@ static const struct rk808_reg_data rk808_pre_init_reg[] = { static const struct rk808_reg_data rk817_pre_init_reg[] = { {RK817_RTC_CTRL_REG, RTC_STOP, RTC_STOP}, +#ifdef CONFIG_SND_SOC_RK817 + /* Codec specific registers */ + { RK817_CODEC_DTOP_VUCTL, MASK_ALL, 0x03 }, + { RK817_CODEC_DTOP_VUCTIME, MASK_ALL, 0x00 }, + { RK817_CODEC_DTOP_LPT_SRST, MASK_ALL, 0x00 }, + { RK817_CODEC_DTOP_DIGEN_CLKE, MASK_ALL, 0x00 }, + /* from vendor driver, CODEC_AREF_RTCFG0 not defined in data sheet */ + { RK817_CODEC_AREF_RTCFG0, MASK_ALL, 0x00 }, + { RK817_CODEC_AREF_RTCFG1, MASK_ALL, 0x06 }, + { RK817_CODEC_AADC_CFG0, MASK_ALL, 0xc8 }, + /* from vendor driver, CODEC_AADC_CFG1 not defined in data sheet */ + { RK817_CODEC_AADC_CFG1, MASK_ALL, 0x00 }, + { RK817_CODEC_DADC_VOLL, MASK_ALL, 0x00 }, + { RK817_CODEC_DADC_VOLR, MASK_ALL, 0x00 }, + { RK817_CODEC_DADC_SR_ACL0, MASK_ALL, 0x00 }, + { RK817_CODEC_DADC_ALC1, MASK_ALL, 0x00 }, + { RK817_CODEC_DADC_ALC2, MASK_ALL, 0x00 }, + { RK817_CODEC_DADC_NG, MASK_ALL, 0x00 }, + { RK817_CODEC_DADC_HPF, MASK_ALL, 0x00 }, + { RK817_CODEC_DADC_RVOLL, MASK_ALL, 0xff }, + { RK817_CODEC_DADC_RVOLR, MASK_ALL, 0xff }, + { RK817_CODEC_AMIC_CFG0, MASK_ALL, 0x70 }, + { RK817_CODEC_AMIC_CFG1, MASK_ALL, 0x00 }, + { RK817_CODEC_DMIC_PGA_GAIN, MASK_ALL, 0x66 }, + { RK817_CODEC_DMIC_LMT1, MASK_ALL, 0x00 }, + { RK817_CODEC_DMIC_LMT2, MASK_ALL, 0x00 }, + { RK817_CODEC_DMIC_NG1, MASK_ALL, 0x00 }, + { RK817_CODEC_DMIC_NG2, MASK_ALL, 0x00 }, + /* from vendor driver, CODEC_ADAC_CFG0 not defined in data sheet */ + { RK817_CODEC_ADAC_CFG0, MASK_ALL, 0x00 }, + { RK817_CODEC_ADAC_CFG1, MASK_ALL, 0x07 }, + { RK817_CODEC_DDAC_POPD_DACST, MASK_ALL, 0x82 }, + { RK817_CODEC_DDAC_VOLL, MASK_ALL, 0x00 }, + { RK817_CODEC_DDAC_VOLR, MASK_ALL, 0x00 }, + { RK817_CODEC_DDAC_SR_LMT0, MASK_ALL, 0x00 }, + { RK817_CODEC_DDAC_LMT1, MASK_ALL, 0x00 }, + { RK817_CODEC_DDAC_LMT2, MASK_ALL, 0x00 }, + { RK817_CODEC_DDAC_MUTE_MIXCTL, MASK_ALL, 0xa0 }, + { RK817_CODEC_DDAC_RVOLL, MASK_ALL, 0xff }, + { RK817_CODEC_DADC_RVOLR, MASK_ALL, 0xff }, + { RK817_CODEC_AMIC_CFG0, MASK_ALL, 0x70 }, + { RK817_CODEC_AMIC_CFG1, MASK_ALL, 0x00 }, + { RK817_CODEC_DMIC_PGA_GAIN, MASK_ALL, 0x66 }, + { RK817_CODEC_DMIC_LMT1, MASK_ALL, 0x00 }, + { RK817_CODEC_DMIC_LMT2, MASK_ALL, 0x00 }, + { RK817_CODEC_DMIC_NG1, MASK_ALL, 0x00 }, + { RK817_CODEC_DMIC_NG2, MASK_ALL, 0x00 }, + /* from vendor driver, CODEC_ADAC_CFG0 not defined in data sheet */ + { RK817_CODEC_ADAC_CFG0, MASK_ALL, 0x00 }, + { RK817_CODEC_ADAC_CFG1, MASK_ALL, 0x07 }, + { RK817_CODEC_DDAC_POPD_DACST, MASK_ALL, 0x82 }, + { RK817_CODEC_DDAC_VOLL, MASK_ALL, 0x00 }, + { RK817_CODEC_DDAC_VOLR, MASK_ALL, 0x00 }, + { RK817_CODEC_DDAC_SR_LMT0, MASK_ALL, 0x00 }, + { RK817_CODEC_DDAC_LMT1, MASK_ALL, 0x00 }, + { RK817_CODEC_DDAC_LMT2, MASK_ALL, 0x00 }, + { RK817_CODEC_DDAC_MUTE_MIXCTL, MASK_ALL, 0xa0 }, + { RK817_CODEC_DDAC_RVOLL, MASK_ALL, 0xff }, + { RK817_CODEC_DDAC_RVOLR, MASK_ALL, 0xff }, + { RK817_CODEC_AHP_ANTI0, MASK_ALL, 0x00 }, + { RK817_CODEC_AHP_ANTI1, MASK_ALL, 0x00 }, + { RK817_CODEC_AHP_CFG0, MASK_ALL, 0xe0 }, + { RK817_CODEC_AHP_CFG1, MASK_ALL, 0x1f }, + { RK817_CODEC_AHP_CP, MASK_ALL, 0x09 }, + { RK817_CODEC_ACLASSD_CFG1, MASK_ALL, 0x69 }, + { RK817_CODEC_ACLASSD_CFG2, MASK_ALL, 0x44 }, + { RK817_CODEC_APLL_CFG0, MASK_ALL, 0x04 }, + { RK817_CODEC_APLL_CFG1, MASK_ALL, 0x00 }, + { RK817_CODEC_APLL_CFG2, MASK_ALL, 0x30 }, + { RK817_CODEC_APLL_CFG3, MASK_ALL, 0x19 }, + { RK817_CODEC_APLL_CFG4, MASK_ALL, 0x65 }, + { RK817_CODEC_APLL_CFG5, MASK_ALL, 0x01 }, + { RK817_CODEC_DI2S_CKM, MASK_ALL, 0x01 }, + { RK817_CODEC_DI2S_RSD, MASK_ALL, 0x00 }, + { RK817_CODEC_DI2S_RXCR1, MASK_ALL, 0x00 }, + { RK817_CODEC_DI2S_RXCR2, MASK_ALL, 0x17 }, + { RK817_CODEC_DI2S_RXCMD_TSD, MASK_ALL, 0x00 }, + { RK817_CODEC_DI2S_TXCR1, MASK_ALL, 0x00 }, + { RK817_CODEC_DI2S_TXCR2, MASK_ALL, 0x17 }, + { RK817_CODEC_DI2S_TXCR3_TXCMD, MASK_ALL, 0x00 }, +#endif {RK817_GPIO_INT_CFG, RK817_INT_POL_MSK, RK817_INT_POL_L}, {RK817_SYS_CFG(1), RK817_HOTDIE_TEMP_MSK | RK817_TSD_TEMP_MSK, RK817_HOTDIE_105 | RK817_TSD_140}, diff --git a/include/linux/mfd/rk808.h b/include/linux/mfd/rk808.h index e07f6e61cd38..a96e6d43ca06 100644 --- a/include/linux/mfd/rk808.h +++ b/include/linux/mfd/rk808.h @@ -437,6 +437,87 @@ enum rk809_reg_id { #define RK817_RTC_COMP_LSB_REG 0x10 #define RK817_RTC_COMP_MSB_REG 0x11 +/* RK817 Codec Registers */ +#define RK817_CODEC_DTOP_VUCTL 0x12 +#define RK817_CODEC_DTOP_VUCTIME 0x13 +#define RK817_CODEC_DTOP_LPT_SRST 0x14 +#define RK817_CODEC_DTOP_DIGEN_CLKE 0x15 +#define RK817_CODEC_AREF_RTCFG0 0x16 +#define RK817_CODEC_AREF_RTCFG1 0x17 +#define RK817_CODEC_AADC_CFG0 0x18 +#define RK817_CODEC_AADC_CFG1 0x19 +#define RK817_CODEC_DADC_VOLL 0x1a +#define RK817_CODEC_DADC_VOLR 0x1b +#define RK817_CODEC_DADC_SR_ACL0 0x1e +#define RK817_CODEC_DADC_ALC1 0x1f +#define RK817_CODEC_DADC_ALC2 0x20 +#define RK817_CODEC_DADC_NG 0x21 +#define RK817_CODEC_DADC_HPF 0x22 +#define RK817_CODEC_DADC_RVOLL 0x23 +#define RK817_CODEC_DADC_RVOLR 0x24 +#define RK817_CODEC_AMIC_CFG0 0x27 +#define RK817_CODEC_AMIC_CFG1 0x28 +#define RK817_CODEC_DMIC_PGA_GAIN 0x29 +#define RK817_CODEC_DMIC_LMT1 0x2a +#define RK817_CODEC_DMIC_LMT2 0x2b +#define RK817_CODEC_DMIC_NG1 0x2c +#define RK817_CODEC_DMIC_NG2 0x2d +#define RK817_CODEC_ADAC_CFG0 0x2e +#define RK817_CODEC_ADAC_CFG1 0x2f +#define RK817_CODEC_DDAC_POPD_DACST 0x30 +#define RK817_CODEC_DDAC_VOLL 0x31 +#define RK817_CODEC_DDAC_VOLR 0x32 +#define RK817_CODEC_DDAC_SR_LMT0 0x35 +#define RK817_CODEC_DDAC_LMT1 0x36 +#define RK817_CODEC_DDAC_LMT2 0x37 +#define RK817_CODEC_DDAC_MUTE_MIXCTL 0x38 +#define RK817_CODEC_DDAC_RVOLL 0x39 +#define RK817_CODEC_DDAC_RVOLR 0x3a +#define RK817_CODEC_AHP_ANTI0 0x3b +#define RK817_CODEC_AHP_ANTI1 0x3c +#define RK817_CODEC_AHP_CFG0 0x3d +#define RK817_CODEC_AHP_CFG1 0x3e +#define RK817_CODEC_AHP_CP 0x3f +#define RK817_CODEC_ACLASSD_CFG1 0x40 +#define RK817_CODEC_ACLASSD_CFG2 0x41 +#define RK817_CODEC_APLL_CFG0 0x42 +#define RK817_CODEC_APLL_CFG1 0x43 +#define RK817_CODEC_APLL_CFG2 0x44 +#define RK817_CODEC_APLL_CFG3 0x45 +#define RK817_CODEC_APLL_CFG4 0x46 +#define RK817_CODEC_APLL_CFG5 0x47 +#define RK817_CODEC_DI2S_CKM 0x48 +#define RK817_CODEC_DI2S_RSD 0x49 +#define RK817_CODEC_DI2S_RXCR1 0x4a +#define RK817_CODEC_DI2S_RXCR2 0x4b +#define RK817_CODEC_DI2S_RXCMD_TSD 0x4c +#define RK817_CODEC_DI2S_TXCR1 0x4d +#define RK817_CODEC_DI2S_TXCR2 0x4e +#define RK817_CODEC_DI2S_TXCR3_TXCMD 0x4f + +/* RK817_CODEC_DI2S_CKM */ +#define RK817_I2S_MODE_MASK (0x1 << 0) +#define RK817_I2S_MODE_MST (0x1 << 0) +#define RK817_I2S_MODE_SLV (0x0 << 0) + +/* RK817_CODEC_DDAC_MUTE_MIXCTL */ +#define DACMT_MASK (0x1 << 0) +#define DACMT_ENABLE (0x1 << 0) +#define DACMT_DISABLE (0x0 << 0) + +/* RK817_CODEC_DI2S_RXCR2 */ +#define VDW_RX_24BITS (0x17) +#define VDW_RX_16BITS (0x0f) + +/* RK817_CODEC_DI2S_TXCR2 */ +#define VDW_TX_24BITS (0x17) +#define VDW_TX_16BITS (0x0f) + +/* RK817_CODEC_AMIC_CFG0 */ +#define MIC_DIFF_MASK (0x1 << 7) +#define MIC_DIFF_DIS (0x0 << 7) +#define MIC_DIFF_EN (0x1 << 7) + #define RK817_POWER_EN_REG(i) (0xb1 + (i)) #define RK817_POWER_SLP_EN_REG(i) (0xb5 + (i)) From patchwork Fri Mar 19 19:13:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Morgan X-Patchwork-Id: 12151769 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.9 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FORGED_HOTMAIL_RCVD2,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0E51FC433C1 for ; Fri, 19 Mar 2021 19:16:17 +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 EBD646194D for ; Fri, 19 Mar 2021 19:16:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EBD646194D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=hotmail.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 5DC0C169D; Fri, 19 Mar 2021 20:15:24 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 5DC0C169D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1616181374; bh=+COaST4GXU0AhBW7zVYf8z7USG1yWfvVSnElBsjyitQ=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=ov3yBlw5U8zZ8OvfR+5krhR3oEiEsCaDgTIjbzG4g4DZwm4M72cf6/1aSAV8Mps71 420uTduJ6lq97wH2Wba6R+E+cXQw57N8uHw/JNJQM6EgC8Cq1vTDLVLGLloi9JUd2J bxbJV79mkFSKaaMFv3OmF2gTmlP/SVPkvALmHR48= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id E03AEF8042F; Fri, 19 Mar 2021 20:14:24 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 4A2B3F8032B; Fri, 19 Mar 2021 20:14:21 +0100 (CET) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12olkn2070.outbound.protection.outlook.com [40.92.22.70]) (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 F0E85F801F7 for ; Fri, 19 Mar 2021 20:14:14 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz F0E85F801F7 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=hotmail.com header.i=@hotmail.com header.b="o/DJh75H" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=g7O+JRe/6z7A8CQQ8HWXenMZNHRLLD+1VCjW3uiGAavQtseth9lg1gxFCWce+3ElPScTqyzHb2G0CKWTa8Ge5n13R2/CTcTLaKxkSY2TX/h2dOnWu1TnJfGtalTp97060CTofKxzOJWZQd3DOf7A4wW5iNVja8jXOaRzBx1TPWgVQ9GUkDKNiES638P/n3gmjX+DoO7Osf72r2Vooz1ZDT8tDu4QndL7O9C/TSWlInfkCTY+agq5HPav2PBhB1cTVJGAvg2BWFPzpdSzTJ5uq3TY8RhYJXB2Lqi2HSwBetDST5Q1TtvrBC+tVVFRucJe+daygGDHfnsMZFqLGAwF3A== 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=N4BI+F3iZRW13oyBhU+EyOW8QomH1BmyNoTrfO8ZbIY=; b=gHW+fKeupu1r1IEGfyqoPfKPY00Ix3ij0CfQwAQFz5nWSADlM1KPT3ItdKd64etwQ4DmnPN+w8tUkOmJrjC0IINo00i+TY1lgP9rYs+2RSuiX+HI7Av0gIlzygYnkbnsq8us+uiK8WQ/DM/4qhHxfKjxuHS0oUZWRkp4XOhcgTMbblu/3I0IdB3dLDFGST/YpR2OBMmvf2RH05vqp/CDXj2wvus4D9cSPhIiVvMLfMg0QUFjN3Utjrl1vz21W6Ju4Vi79KkglOSebGVSFC+7hdCcfjwqqbhnxfryVoxO43unNUO4hvjX2HG2JeKJtwlR4NggkprIBTA2/cg+jBnGeQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hotmail.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=N4BI+F3iZRW13oyBhU+EyOW8QomH1BmyNoTrfO8ZbIY=; b=o/DJh75Hrhf1TAWP4aGL4yiAKysGVcghjXpsF3nlcpLdTMtDlzTUnpZc/RH07zdKxFsd8NmtqGR0Sc5SaxcoDGr0SIkCFvTSd08kLw7Ne8vafZkgWd3O+WYEszPBS2Ls6LHevvWa/s2FNjM2xI7JvjYb9jdr+jCRRX00o8RBfAoKId4Y7XtunkZeU9AS0GxAN6UXOFVKIatKkSAjYK3SlO12WrV2nCD3dtPEytYfyrKmfyKkkYWvvSGiNcUjpsip2AmlLkRU2wfKCO8Gcnp+vq6foES7ljNBAqdlSwS4iHfvq+Ljw1BwFcArsCZpYuQJMNatc5VMxp6RlSTduyzHcw== Received: from BN8NAM12FT062.eop-nam12.prod.protection.outlook.com (2a01:111:e400:fc66::41) by BN8NAM12HT048.eop-nam12.prod.protection.outlook.com (2a01:111:e400:fc66::304) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3955.9; Fri, 19 Mar 2021 19:13:57 +0000 Received: from SN6PR06MB5342.namprd06.prod.outlook.com (2a01:111:e400:fc66::53) by BN8NAM12FT062.mail.protection.outlook.com (2a01:111:e400:fc66::321) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3955.9 via Frontend Transport; Fri, 19 Mar 2021 19:13:57 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:69FACDD8D5540BD23725B9DE9AF31774522DC4308E707015113188518E5D9225; UpperCasedChecksum:22E1292115BF39EDE6AA16A18337FD0AB22159D5E9864F1930F0FD2395E7D48A; SizeAsReceived:7525; Count:47 Received: from SN6PR06MB5342.namprd06.prod.outlook.com ([fe80::fc38:a692:c2c8:f63e]) by SN6PR06MB5342.namprd06.prod.outlook.com ([fe80::fc38:a692:c2c8:f63e%7]) with mapi id 15.20.3955.018; Fri, 19 Mar 2021 19:13:57 +0000 From: Chris Morgan To: alsa-devel@alsa-project.org Subject: [PATCH v5 2/4] ASoC: Add Rockchip rk817 audio CODEC support Date: Fri, 19 Mar 2021 14:13:35 -0500 Message-ID: X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210319191337.9414-1-macromorgan@hotmail.com> References: <20210319191337.9414-1-macromorgan@hotmail.com> X-TMN: [O1bZ/Ymnu1hh2LrZtC3iLRj31XpCSjDQ] X-ClientProxiedBy: SN1PR12CA0044.namprd12.prod.outlook.com (2603:10b6:802:20::15) To SN6PR06MB5342.namprd06.prod.outlook.com (2603:10b6:805:f9::31) X-Microsoft-Original-Message-ID: <20210319191337.9414-2-macromorgan@hotmail.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from wintermute.localdomain (76.183.134.35) by SN1PR12CA0044.namprd12.prod.outlook.com (2603:10b6:802:20::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3955.18 via Frontend Transport; Fri, 19 Mar 2021 19:13:55 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 47 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: 9b399a0c-50f3-4445-050f-08d8eb0b245f X-MS-Exchange-SLBlob-MailProps: zswcL9HXbeXsGxgxUGH+YTsWg2A96AcwJs0vmYUkKo5w2KX+2LrHdrO3MyDnFRDUC2HnWuUp837KYES9FpRFnmRpqfpGA7TP3FyaoAfhMi3Zz2NL2u5VWxDBo8SENO47xa8MX0Q0kPMTNfQDyalpzylrTQ/TKy4njVoF9qA8/R+6pzaKp98+skF02srYg98TBj2HGnxQD5BtRYx8LbQ90cwrV/TyJ5hvrewWCESbiWeeLe3YTMBRJaC+qcHMiC9lGsKduUp6wbtMugquzNU9QQM58ObbA6pBvccKHM939FmZ0M7118pM+5HO2+4bFxyixdDVLfvLALFWNXuGAnGaffblXWVB3urAMVrDa9Cf8qzDoPyR/k1nQGvg6jdvn1cDgN3yV4z5+gJtOHz5yzdT2MQw01Qhloqnpy9oqfKQoCD1HiIhFE1KYnXv6igoRg6zofawm81IcLOPRhSFFveuOa9CCN1sGOTk+DspbNRBJz4Rqq3bLz9f3dDXV6VqnwksOYMk5YQNZETu2QqaGiNiuTfbwPAg2nCk5s5SqizpkUrmhVpry+9fnt9JlKccHPlkHPx5s68alpAkCSr7ATNMND1ZIKK2HrEXEsyHK4sL4uuF4iJk6JZS63AWa1Lje3OJJ92s7NN7d+8R1XTUCRjz+nx3/WWGATa/aQJ6rtcat8DyK/ERPhRHidKWg87/+Ndz8LsPioEAlsTHwWClt9qZD/hCEEeNvNDD3XCh7QRtjxNIlfXRwDP4GI0o14VSPxi5 X-MS-TrafficTypeDiagnostic: BN8NAM12HT048: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: TYlK1gquEeDWomg4mMZlAbOWsea44tVafoF96IcW1NddYilVUIYPGzNd1MsC0kKlNzFucz0TbSF5U4gmV+HpSOgcKpW4C11cxqG37yQR9nYNqgGHMN0+SMn6t2sc9P1CHp9h/B6L5brWN8QiFsXmN90WWnnDW5vAgisQlzRznkRYGsJ+TQPAypdEEl6CNSad2NLzAdRKiWgf0FgUk3cy1TKK1kzdtT2WR8GcLRj7a+1zsyu8Hv/lnkgYnyDgzY7yPhIFarUxp2bv/TQGs8gNOAZl6KLAwrANT5hjtmcjMC/Vz4HNTZh/brAjDx2Gtp3/LzxrQcRAS03gb2ioiQ3koaVw5/VQSFIi9fgfAfDPEdm0NC8bneR7H5bu+1UvMKrmhGq4HBGWyAiv0Ws/pxWsJw== X-MS-Exchange-AntiSpam-MessageData: tog9sYqrM6pFjoMHjsS9jc7zjuZZo7Nr4wl2n3c6dJgbEVJ/j71IpitMKD9d3VwXjEc1OMwVR4FQkLBhmZxHTjI9V1llGF1T3vYC1H1CKqgqWZKa8OEe/sKrbJvSsRvRlQi9LXU7AdabvsPcbxb+Jw== X-OriginatorOrg: hotmail.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9b399a0c-50f3-4445-050f-08d8eb0b245f X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Mar 2021 19:13:57.0703 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-AuthSource: BN8NAM12FT062.eop-nam12.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: Internet X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN8NAM12HT048 Cc: broonie@kernel.org, heiko@sntech.de, pierre-louis.bossart@linux.intel.com, Chris Morgan , tiwai@suse.com 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" Add support for the Rockchip rk817 audio codec integrated into the rk817 PMIC. This is based on the sources provided by Rockchip from their BSP kernel. Changes from v4: Switched to using parent regmap instead of private regmap. Removed of_compatible strings. Removed register definitions and moved them to the MFD driver. Signed-off-by: Chris Morgan Reviewed-by: Mark Brown --- sound/soc/codecs/Kconfig | 6 + sound/soc/codecs/Makefile | 2 + sound/soc/codecs/rk817_codec.c | 560 +++++++++++++++++++++++++++++++++ 3 files changed, 566 insertions(+) create mode 100644 sound/soc/codecs/rk817_codec.c diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig index e4cf14e66a51..d835145ad65e 100644 --- a/sound/soc/codecs/Kconfig +++ b/sound/soc/codecs/Kconfig @@ -155,6 +155,7 @@ config SND_SOC_ALL_CODECS imply SND_SOC_PCM512x_I2C imply SND_SOC_PCM512x_SPI imply SND_SOC_RK3328 + imply SND_SOC_RK817 imply SND_SOC_RT274 imply SND_SOC_RT286 imply SND_SOC_RT298 @@ -1059,6 +1060,11 @@ config SND_SOC_RK3328 tristate "Rockchip RK3328 audio CODEC" select REGMAP_MMIO +config SND_SOC_RK817 + tristate "Rockchip RK817 audio CODEC" + depends on MFD_RK808 + select REGMAP_I2C + config SND_SOC_RL6231 tristate default y if SND_SOC_RT5514=y diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile index 81357dc62ea0..4e5e9b28775c 100644 --- a/sound/soc/codecs/Makefile +++ b/sound/soc/codecs/Makefile @@ -165,6 +165,7 @@ snd-soc-pcm512x-objs := pcm512x.o snd-soc-pcm512x-i2c-objs := pcm512x-i2c.o snd-soc-pcm512x-spi-objs := pcm512x-spi.o snd-soc-rk3328-objs := rk3328_codec.o +snd-soc-rk817-objs := rk817_codec.o snd-soc-rl6231-objs := rl6231.o snd-soc-rl6347a-objs := rl6347a.o snd-soc-rt1011-objs := rt1011.o @@ -479,6 +480,7 @@ obj-$(CONFIG_SND_SOC_PCM512x) += snd-soc-pcm512x.o obj-$(CONFIG_SND_SOC_PCM512x_I2C) += snd-soc-pcm512x-i2c.o obj-$(CONFIG_SND_SOC_PCM512x_SPI) += snd-soc-pcm512x-spi.o obj-$(CONFIG_SND_SOC_RK3328) += snd-soc-rk3328.o +obj-$(CONFIG_SND_SOC_RK817) += snd-soc-rk817.o obj-$(CONFIG_SND_SOC_RL6231) += snd-soc-rl6231.o obj-$(CONFIG_SND_SOC_RL6347A) += snd-soc-rl6347a.o obj-$(CONFIG_SND_SOC_RT1011) += snd-soc-rt1011.o diff --git a/sound/soc/codecs/rk817_codec.c b/sound/soc/codecs/rk817_codec.c new file mode 100644 index 000000000000..0ad097db04bd --- /dev/null +++ b/sound/soc/codecs/rk817_codec.c @@ -0,0 +1,560 @@ +// SPDX-License-Identifier: GPL-2.0 +// +// rk817 ALSA SoC Audio driver +// +// Copyright (c) 2018, Fuzhou Rockchip Electronics Co., Ltd All rights reserved. + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +struct rk817_codec_priv { + struct snd_soc_component *component; + struct rk808 *rk808; + struct clk *mclk; + unsigned int stereo_sysclk; + bool mic_in_differential; +}; + +/* + * This sets the codec up with the values defined in the default implementation including the APLL + * from the Rockchip vendor kernel. I do not know if these values are universal despite differing + * from the default values defined above and taken from the datasheet, or implementation specific. + * I don't have another implementation to compare from the Rockchip sources. Hard-coding for now. + * Additionally, I do not know according to the documentation the units accepted for the clock + * values, so for the moment those are left unvalidated. + */ + +static int rk817_init(struct snd_soc_component *component) +{ + struct rk817_codec_priv *rk817 = snd_soc_component_get_drvdata(component); + + snd_soc_component_write(component, RK817_CODEC_DDAC_POPD_DACST, 0x02); + snd_soc_component_write(component, RK817_CODEC_DDAC_SR_LMT0, 0x02); + snd_soc_component_write(component, RK817_CODEC_DADC_SR_ACL0, 0x02); + snd_soc_component_write(component, RK817_CODEC_DTOP_VUCTIME, 0xf4); + if (rk817->mic_in_differential) { + snd_soc_component_update_bits(component, RK817_CODEC_AMIC_CFG0, MIC_DIFF_MASK, + MIC_DIFF_EN); + }; + return 0; +} + +static int rk817_set_component_pll(struct snd_soc_component *component, + int pll_id, int source, unsigned int freq_in, + unsigned int freq_out) +{ + /* Set resistor value and charge pump current for PLL. */ + snd_soc_component_write(component, RK817_CODEC_APLL_CFG1, 0x58); + /* Set the PLL feedback clock divide value (values not documented). */ + snd_soc_component_write(component, RK817_CODEC_APLL_CFG2, 0x2d); + /* Set the PLL pre-divide value (values not documented). */ + snd_soc_component_write(component, RK817_CODEC_APLL_CFG3, 0x0c); + /* Set the PLL VCO output clock divide and PLL divided ratio of PLL High Clk (values not + * documented). + */ + snd_soc_component_write(component, RK817_CODEC_APLL_CFG4, 0xa5); + + return 0; +} + +/* + * DDAC/DADC L/R volume setting + * 0db~-95db, 0.375db/step, for example: + * 0x00: 0dB + * 0xff: -95dB + */ + +static const DECLARE_TLV_DB_MINMAX(rk817_vol_tlv, -9500, 0); + +/* + * PGA GAIN L/R volume setting + * 27db~-18db, 3db/step, for example: + * 0x0: -18dB + * 0xf: 27dB + */ + +static const DECLARE_TLV_DB_MINMAX(rk817_gain_tlv, -1800, 2700); + +static const struct snd_kcontrol_new rk817_volume_controls[] = { + SOC_DOUBLE_R_RANGE_TLV("Master Playback Volume", RK817_CODEC_DDAC_VOLL, + RK817_CODEC_DDAC_VOLR, 0, 0x00, 0xff, 1, rk817_vol_tlv), + SOC_DOUBLE_R_RANGE_TLV("Master Capture Volume", RK817_CODEC_DADC_VOLL, + RK817_CODEC_DADC_VOLR, 0, 0x00, 0xff, 1, rk817_vol_tlv), + SOC_DOUBLE_TLV("Mic Capture Gain", RK817_CODEC_DMIC_PGA_GAIN, 4, 0, 0xf, 0, + rk817_gain_tlv), +}; + +/* Since the speaker output and L headphone pin are internally the same, make audio path mutually + * exclusive with a mux. + */ + +static const char *dac_mux_text[] = { + "HP", + "SPK", +}; + +static SOC_ENUM_SINGLE_VIRT_DECL(dac_enum, dac_mux_text); + +static const struct snd_kcontrol_new dac_mux = + SOC_DAPM_ENUM("Playback Mux", dac_enum); + +static const struct snd_soc_dapm_widget rk817_dapm_widgets[] = { + + /* capture/playback common */ + SND_SOC_DAPM_SUPPLY("LDO Regulator", RK817_CODEC_AREF_RTCFG1, 6, 0, NULL, 0), + SND_SOC_DAPM_SUPPLY("IBIAS Block", RK817_CODEC_AREF_RTCFG1, 2, 1, NULL, 0), + SND_SOC_DAPM_SUPPLY("VAvg Buffer", RK817_CODEC_AREF_RTCFG1, 1, 1, NULL, 0), + SND_SOC_DAPM_SUPPLY("PLL Power", RK817_CODEC_APLL_CFG5, 0, 1, NULL, 0), + SND_SOC_DAPM_SUPPLY("I2S TX1 Transfer Start", RK817_CODEC_DI2S_RXCMD_TSD, 5, 0, NULL, 0), + + /* capture path common */ + SND_SOC_DAPM_SUPPLY("ADC Clock", RK817_CODEC_DTOP_DIGEN_CLKE, 7, 0, NULL, 0), + SND_SOC_DAPM_SUPPLY("I2S TX Clock", RK817_CODEC_DTOP_DIGEN_CLKE, 6, 0, NULL, 0), + SND_SOC_DAPM_SUPPLY("ADC Channel Enable", RK817_CODEC_DTOP_DIGEN_CLKE, 5, 0, NULL, 0), + SND_SOC_DAPM_SUPPLY("I2S TX Channel Enable", RK817_CODEC_DTOP_DIGEN_CLKE, 4, 0, NULL, 0), + SND_SOC_DAPM_SUPPLY("MIC Power On", RK817_CODEC_AMIC_CFG0, 6, 1, NULL, 0), + SND_SOC_DAPM_SUPPLY("I2S TX3 Transfer Start", RK817_CODEC_DI2S_TXCR3_TXCMD, 7, 0, NULL, 0), + SND_SOC_DAPM_SUPPLY("I2S TX3 Right Justified", RK817_CODEC_DI2S_TXCR3_TXCMD, 3, 0, NULL, 0), + + /* capture path L */ + SND_SOC_DAPM_ADC("ADC L", "Capture", RK817_CODEC_AADC_CFG0, 7, 1), + SND_SOC_DAPM_SUPPLY("PGA L Power On", RK817_CODEC_AMIC_CFG0, 5, 1, NULL, 0), + SND_SOC_DAPM_SUPPLY("Mic Boost L1", RK817_CODEC_AMIC_CFG0, 3, 0, NULL, 0), + SND_SOC_DAPM_SUPPLY("Mic Boost L2", RK817_CODEC_AMIC_CFG0, 2, 0, NULL, 0), + + /* capture path R */ + SND_SOC_DAPM_ADC("ADC R", "Capture", RK817_CODEC_AADC_CFG0, 6, 1), + SND_SOC_DAPM_SUPPLY("PGA R Power On", RK817_CODEC_AMIC_CFG0, 4, 1, NULL, 0), + SND_SOC_DAPM_SUPPLY("Mic Boost R1", RK817_CODEC_AMIC_CFG0, 3, 0, NULL, 0), + SND_SOC_DAPM_SUPPLY("Mic Boost R2", RK817_CODEC_AMIC_CFG0, 3, 0, NULL, 0), + + /* playback path common */ + SND_SOC_DAPM_SUPPLY("DAC Clock", RK817_CODEC_DTOP_DIGEN_CLKE, 3, 0, NULL, 0), + SND_SOC_DAPM_SUPPLY("I2S RX Clock", RK817_CODEC_DTOP_DIGEN_CLKE, 2, 0, NULL, 0), + SND_SOC_DAPM_SUPPLY("DAC Channel Enable", RK817_CODEC_DTOP_DIGEN_CLKE, 1, 0, NULL, 0), + SND_SOC_DAPM_SUPPLY("I2S RX Channel Enable", RK817_CODEC_DTOP_DIGEN_CLKE, 0, 0, NULL, 0), + SND_SOC_DAPM_SUPPLY("DAC Bias", RK817_CODEC_ADAC_CFG1, 3, 1, NULL, 0), + SND_SOC_DAPM_SUPPLY("DAC Mute Off", RK817_CODEC_DDAC_MUTE_MIXCTL, 0, 1, NULL, 0), + + /* playback path speaker */ + SND_SOC_DAPM_SUPPLY("Class D Mode", RK817_CODEC_DDAC_MUTE_MIXCTL, 4, 0, NULL, 0), + SND_SOC_DAPM_SUPPLY("High Pass Filter", RK817_CODEC_DDAC_MUTE_MIXCTL, 7, 0, NULL, 0), + SND_SOC_DAPM_DAC("SPK DAC", "Playback", RK817_CODEC_ADAC_CFG1, 2, 1), + SND_SOC_DAPM_SUPPLY("Enable Class D", RK817_CODEC_ACLASSD_CFG1, 7, 0, NULL, 0), + SND_SOC_DAPM_SUPPLY("Disable Class D Mute Ramp", RK817_CODEC_ACLASSD_CFG1, 6, 1, NULL, 0), + SND_SOC_DAPM_SUPPLY("Class D Mute Rate 1", RK817_CODEC_ACLASSD_CFG1, 3, 0, NULL, 0), + SND_SOC_DAPM_SUPPLY("Class D Mute Rate 2", RK817_CODEC_ACLASSD_CFG1, 2, 1, NULL, 0), + SND_SOC_DAPM_SUPPLY("Class D OCPP 2", RK817_CODEC_ACLASSD_CFG2, 5, 0, NULL, 0), + SND_SOC_DAPM_SUPPLY("Class D OCPP 3", RK817_CODEC_ACLASSD_CFG2, 4, 0, NULL, 0), + SND_SOC_DAPM_SUPPLY("Class D OCPN 2", RK817_CODEC_ACLASSD_CFG2, 1, 0, NULL, 0), + SND_SOC_DAPM_SUPPLY("Class D OCPN 3", RK817_CODEC_ACLASSD_CFG2, 0, 0, NULL, 0), + + /* playback path headphones */ + SND_SOC_DAPM_SUPPLY("Headphone Charge Pump", RK817_CODEC_AHP_CP, 4, 0, NULL, 0), + SND_SOC_DAPM_SUPPLY("Headphone CP Discharge LDO", RK817_CODEC_AHP_CP, 3, 1, NULL, 0), + SND_SOC_DAPM_SUPPLY("Headphone OStage", RK817_CODEC_AHP_CFG0, 6, 1, NULL, 0), + SND_SOC_DAPM_SUPPLY("Headphone Pre Amp", RK817_CODEC_AHP_CFG0, 5, 1, NULL, 0), + SND_SOC_DAPM_DAC("DAC L", "Playback", RK817_CODEC_ADAC_CFG1, 1, 1), + SND_SOC_DAPM_DAC("DAC R", "Playback", RK817_CODEC_ADAC_CFG1, 0, 1), + + /* Mux for input/output path selection */ + SND_SOC_DAPM_MUX("Playback Mux", SND_SOC_NOPM, 1, 0, &dac_mux), + + /* Pins for Simple Card Bindings */ + SND_SOC_DAPM_INPUT("MICL"), + SND_SOC_DAPM_INPUT("MICR"), + SND_SOC_DAPM_OUTPUT("HPOL"), + SND_SOC_DAPM_OUTPUT("HPOR"), + SND_SOC_DAPM_OUTPUT("SPKO"), +}; + +static const struct snd_soc_dapm_route rk817_dapm_routes[] = { + + /* capture path */ + /* left mic */ + {"ADC L", NULL, "LDO Regulator"}, + {"ADC L", NULL, "IBIAS Block"}, + {"ADC L", NULL, "VAvg Buffer"}, + {"ADC L", NULL, "PLL Power"}, + {"ADC L", NULL, "ADC Clock"}, + {"ADC L", NULL, "I2S TX Clock"}, + {"ADC L", NULL, "ADC Channel Enable"}, + {"ADC L", NULL, "I2S TX Channel Enable"}, + {"ADC L", NULL, "I2S TX1 Transfer Start"}, + {"MICL", NULL, "MIC Power On"}, + {"MICL", NULL, "PGA L Power On"}, + {"MICL", NULL, "Mic Boost L1"}, + {"MICL", NULL, "Mic Boost L2"}, + {"MICL", NULL, "I2S TX3 Transfer Start"}, + {"MICL", NULL, "I2S TX3 Right Justified"}, + {"ADC L", NULL, "MICL"}, + + /* right mic */ + {"ADC R", NULL, "LDO Regulator"}, + {"ADC R", NULL, "IBIAS Block"}, + {"ADC R", NULL, "VAvg Buffer"}, + {"ADC R", NULL, "PLL Power"}, + {"ADC R", NULL, "ADC Clock"}, + {"ADC R", NULL, "I2S TX Clock"}, + {"ADC R", NULL, "ADC Channel Enable"}, + {"ADC R", NULL, "I2S TX Channel Enable"}, + {"ADC R", NULL, "I2S TX1 Transfer Start"}, + {"MICR", NULL, "MIC Power On"}, + {"MICR", NULL, "PGA R Power On"}, + {"MICR", NULL, "Mic Boost R1"}, + {"MICR", NULL, "Mic Boost R2"}, + {"MICR", NULL, "I2S TX3 Transfer Start"}, + {"MICR", NULL, "I2S TX3 Right Justified"}, + {"ADC R", NULL, "MICR"}, + + /* playback path */ + /* speaker path */ + {"SPK DAC", NULL, "LDO Regulator"}, + {"SPK DAC", NULL, "IBIAS Block"}, + {"SPK DAC", NULL, "VAvg Buffer"}, + {"SPK DAC", NULL, "PLL Power"}, + {"SPK DAC", NULL, "I2S TX1 Transfer Start"}, + {"SPK DAC", NULL, "DAC Clock"}, + {"SPK DAC", NULL, "I2S RX Clock"}, + {"SPK DAC", NULL, "DAC Channel Enable"}, + {"SPK DAC", NULL, "I2S RX Channel Enable"}, + {"SPK DAC", NULL, "Class D Mode"}, + {"SPK DAC", NULL, "DAC Bias"}, + {"SPK DAC", NULL, "DAC Mute Off"}, + {"SPK DAC", NULL, "Enable Class D"}, + {"SPK DAC", NULL, "Disable Class D Mute Ramp"}, + {"SPK DAC", NULL, "Class D Mute Rate 1"}, + {"SPK DAC", NULL, "Class D Mute Rate 2"}, + {"SPK DAC", NULL, "Class D OCPP 2"}, + {"SPK DAC", NULL, "Class D OCPP 3"}, + {"SPK DAC", NULL, "Class D OCPN 2"}, + {"SPK DAC", NULL, "Class D OCPN 3"}, + {"SPK DAC", NULL, "High Pass Filter"}, + + /* headphone path L */ + {"DAC L", NULL, "LDO Regulator"}, + {"DAC L", NULL, "IBIAS Block"}, + {"DAC L", NULL, "VAvg Buffer"}, + {"DAC L", NULL, "PLL Power"}, + {"DAC L", NULL, "I2S TX1 Transfer Start"}, + {"DAC L", NULL, "DAC Clock"}, + {"DAC L", NULL, "I2S RX Clock"}, + {"DAC L", NULL, "DAC Channel Enable"}, + {"DAC L", NULL, "I2S RX Channel Enable"}, + {"DAC L", NULL, "DAC Bias"}, + {"DAC L", NULL, "DAC Mute Off"}, + {"DAC L", NULL, "Headphone Charge Pump"}, + {"DAC L", NULL, "Headphone CP Discharge LDO"}, + {"DAC L", NULL, "Headphone OStage"}, + {"DAC L", NULL, "Headphone Pre Amp"}, + + /* headphone path R */ + {"DAC R", NULL, "LDO Regulator"}, + {"DAC R", NULL, "IBIAS Block"}, + {"DAC R", NULL, "VAvg Buffer"}, + {"DAC R", NULL, "PLL Power"}, + {"DAC R", NULL, "I2S TX1 Transfer Start"}, + {"DAC R", NULL, "DAC Clock"}, + {"DAC R", NULL, "I2S RX Clock"}, + {"DAC R", NULL, "DAC Channel Enable"}, + {"DAC R", NULL, "I2S RX Channel Enable"}, + {"DAC R", NULL, "DAC Bias"}, + {"DAC R", NULL, "DAC Mute Off"}, + {"DAC R", NULL, "Headphone Charge Pump"}, + {"DAC R", NULL, "Headphone CP Discharge LDO"}, + {"DAC R", NULL, "Headphone OStage"}, + {"DAC R", NULL, "Headphone Pre Amp"}, + + /* mux path for output selection */ + {"Playback Mux", "HP", "DAC L"}, + {"Playback Mux", "HP", "DAC R"}, + {"Playback Mux", "SPK", "SPK DAC"}, + {"SPKO", NULL, "Playback Mux"}, + {"HPOL", NULL, "Playback Mux"}, + {"HPOR", NULL, "Playback Mux"}, +}; + +static int rk817_set_dai_sysclk(struct snd_soc_dai *codec_dai, + int clk_id, unsigned int freq, int dir) +{ + struct snd_soc_component *component = codec_dai->component; + struct rk817_codec_priv *rk817 = snd_soc_component_get_drvdata(component); + + rk817->stereo_sysclk = freq; + + return 0; +} + +static int rk817_set_dai_fmt(struct snd_soc_dai *codec_dai, + unsigned int fmt) +{ + struct snd_soc_component *component = codec_dai->component; + unsigned int i2s_mst = 0; + + switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { + case SND_SOC_DAIFMT_CBS_CFS: + i2s_mst |= RK817_I2S_MODE_SLV; + break; + case SND_SOC_DAIFMT_CBM_CFM: + i2s_mst |= RK817_I2S_MODE_MST; + break; + default: + dev_err(component->dev, "%s : set master mask failed!\n", __func__); + return -EINVAL; + } + + snd_soc_component_update_bits(component, RK817_CODEC_DI2S_CKM, + RK817_I2S_MODE_MASK, i2s_mst); + + return 0; +} + +static int rk817_hw_params(struct snd_pcm_substream *substream, + struct snd_pcm_hw_params *params, + struct snd_soc_dai *dai) +{ + struct snd_soc_component *component = dai->component; + + switch (params_format(params)) { + case SNDRV_PCM_FORMAT_S16_LE: + snd_soc_component_write(component, RK817_CODEC_DI2S_RXCR2, + VDW_RX_16BITS); + snd_soc_component_write(component, RK817_CODEC_DI2S_TXCR2, + VDW_TX_16BITS); + break; + case SNDRV_PCM_FORMAT_S24_LE: + case SNDRV_PCM_FORMAT_S32_LE: + snd_soc_component_write(component, RK817_CODEC_DI2S_RXCR2, + VDW_RX_24BITS); + snd_soc_component_write(component, RK817_CODEC_DI2S_TXCR2, + VDW_TX_24BITS); + break; + default: + return -EINVAL; + } + + return 0; +} + +static int rk817_digital_mute(struct snd_soc_dai *dai, int mute, int stream) +{ + struct snd_soc_component *component = dai->component; + + if (mute) + snd_soc_component_update_bits(component, + RK817_CODEC_DDAC_MUTE_MIXCTL, + DACMT_MASK, DACMT_ENABLE); + else + snd_soc_component_update_bits(component, + RK817_CODEC_DDAC_MUTE_MIXCTL, + DACMT_MASK, DACMT_DISABLE); + + return 0; +} + +#define RK817_PLAYBACK_RATES (SNDRV_PCM_RATE_8000 |\ + SNDRV_PCM_RATE_16000 | \ + SNDRV_PCM_RATE_32000 | \ + SNDRV_PCM_RATE_44100 | \ + SNDRV_PCM_RATE_48000 | \ + SNDRV_PCM_RATE_96000) + +#define RK817_CAPTURE_RATES (SNDRV_PCM_RATE_8000 |\ + SNDRV_PCM_RATE_16000 | \ + SNDRV_PCM_RATE_32000 | \ + SNDRV_PCM_RATE_44100 | \ + SNDRV_PCM_RATE_48000 | \ + SNDRV_PCM_RATE_96000) + +#define RK817_FORMATS (SNDRV_PCM_FMTBIT_S16_LE |\ + SNDRV_PCM_FMTBIT_S20_3LE |\ + SNDRV_PCM_FMTBIT_S24_LE |\ + SNDRV_PCM_FMTBIT_S32_LE) + +static struct snd_soc_dai_ops rk817_dai_ops = { + .hw_params = rk817_hw_params, + .set_fmt = rk817_set_dai_fmt, + .set_sysclk = rk817_set_dai_sysclk, + .mute_stream = rk817_digital_mute, + .no_capture_mute = 1, +}; + +static struct snd_soc_dai_driver rk817_dai[] = { + { + .name = "rk817-hifi", + .playback = { + .stream_name = "Playback", + .channels_min = 2, + .channels_max = 8, + .rates = RK817_PLAYBACK_RATES, + .formats = RK817_FORMATS, + }, + .capture = { + .stream_name = "Capture", + .channels_min = 1, + .channels_max = 2, + .rates = RK817_CAPTURE_RATES, + .formats = RK817_FORMATS, + }, + .ops = &rk817_dai_ops, + }, +}; + +static int rk817_probe(struct snd_soc_component *component) +{ + struct rk817_codec_priv *rk817 = snd_soc_component_get_drvdata(component); + struct rk808 *rk808 = dev_get_drvdata(component->dev->parent); + int ret; + + snd_soc_component_init_regmap(component, rk808->regmap); + rk817->component = component; + + ret = snd_soc_component_write(component, RK817_CODEC_DTOP_LPT_SRST, 0x40); + + rk817_init(component); + + /* setting initial pll values so that we can continue to leverage simple-audio-card. + * The values aren't important since no parameters are used. + */ + + snd_soc_component_set_pll(component, 0, 0, 0, 0); + + return 0; +} + +static void rk817_remove(struct snd_soc_component *component) +{ + snd_soc_component_exit_regmap(component); +} + +static const struct snd_soc_component_driver soc_codec_dev_rk817 = { + .probe = rk817_probe, + .remove = rk817_remove, + .idle_bias_on = 1, + .use_pmdown_time = 1, + .endianness = 1, + .non_legacy_dai_naming = 1, + .controls = rk817_volume_controls, + .num_controls = ARRAY_SIZE(rk817_volume_controls), + .dapm_routes = rk817_dapm_routes, + .num_dapm_routes = ARRAY_SIZE(rk817_dapm_routes), + .dapm_widgets = rk817_dapm_widgets, + .num_dapm_widgets = ARRAY_SIZE(rk817_dapm_widgets), + .set_pll = rk817_set_component_pll, +}; + +static int rk817_codec_parse_dt_property(struct device *dev, + struct rk817_codec_priv *rk817) +{ + struct device_node *node = dev->parent->of_node; + + if (!node) { + dev_err(dev, "%s() dev->parent->of_node is NULL\n", + __func__); + return -ENODEV; + } + + node = of_get_child_by_name(dev->parent->of_node, "codec"); + if (!node) { + dev_err(dev, "%s() Can not get child: codec\n", + __func__); + return -ENODEV; + } + + rk817->mic_in_differential = + of_property_read_bool(node, "mic-in-differential"); + + return 0; +} + +static int rk817_platform_probe(struct platform_device *pdev) +{ + struct rk808 *rk808 = dev_get_drvdata(pdev->dev.parent); + struct rk817_codec_priv *rk817_codec_data; + int ret; + + if (!rk808) { + dev_err(&pdev->dev, "%s : rk817 is NULL\n", __func__); + return -EINVAL; + } + + rk817_codec_data = devm_kzalloc(&pdev->dev, + sizeof(struct rk817_codec_priv), + GFP_KERNEL); + if (!rk817_codec_data) + return -ENOMEM; + + platform_set_drvdata(pdev, rk817_codec_data); + + rk817_codec_data->rk808 = rk808; + + ret = rk817_codec_parse_dt_property(&pdev->dev, rk817_codec_data); + if (ret < 0) { + dev_err(&pdev->dev, "%s() parse device tree property error %d\n", + __func__, ret); + goto err_; + } + + rk817_codec_data->mclk = clk_get(pdev->dev.parent, "mclk"); + if (IS_ERR(rk817_codec_data->mclk)) { + dev_err(&pdev->dev, "Unable to get mclk\n"); + ret = -ENXIO; + goto err_; + } + + ret = clk_prepare_enable(rk817_codec_data->mclk); + if (ret < 0) { + dev_err(&pdev->dev, "%s() clock prepare error %d\n", + __func__, ret); + goto err_; + } + + ret = devm_snd_soc_register_component(&pdev->dev, &soc_codec_dev_rk817, + rk817_dai, ARRAY_SIZE(rk817_dai)); + if (ret < 0) { + dev_err(&pdev->dev, "%s() register codec error %d\n", + __func__, ret); + goto err_; + } + + return 0; +err_: + + return ret; +} + +static int rk817_platform_remove(struct platform_device *pdev) +{ + struct rk817_codec_priv *rk817 = platform_get_drvdata(pdev); + + clk_disable_unprepare(rk817->mclk); + + return 0; +} + +MODULE_DEVICE_TABLE(of, rk817_codec_dt_ids); + +static struct platform_driver rk817_codec_driver = { + .driver = { + .name = "rk817-codec", + }, + .probe = rk817_platform_probe, + .remove = rk817_platform_remove, +}; + +module_platform_driver(rk817_codec_driver); + +MODULE_DESCRIPTION("ASoC RK817 codec driver"); +MODULE_AUTHOR("binyuan "); +MODULE_LICENSE("GPL v2"); From patchwork Fri Mar 19 19:13:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Morgan X-Patchwork-Id: 12151765 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.9 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FORGED_HOTMAIL_RCVD2,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 578AEC433C1 for ; Fri, 19 Mar 2021 19:15:13 +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 AA1716197A for ; Fri, 19 Mar 2021 19:15:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AA1716197A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=hotmail.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 1CCE41675; Fri, 19 Mar 2021 20:14:19 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 1CCE41675 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1616181309; bh=XZYjb6QL+4pM8ZA9ca+Lq5CIeW+qjVc8y7Yo4tJKPLY=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=gJ2YrPaWGRIJEVlPMTEpupH1jlEeN1wpqSCL4nBn+EhnjOMHeKgFrXKDmPeQU6eUe qL+zGTeCP3lDHAK0roWJ0oUzNIeYp8A4XjKaL4UNzi9xsGA6u/BoiPffMht32XP+ZY wU7YQt0A38kZxt2oMoKAmyqvmu/JTqjkfspC2U8k= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 61310F8023C; Fri, 19 Mar 2021 20:14:18 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id CB18CF8023C; Fri, 19 Mar 2021 20:14:15 +0100 (CET) Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12olkn2100.outbound.protection.outlook.com [40.92.21.100]) (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 9BF48F80124 for ; Fri, 19 Mar 2021 20:14:06 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 9BF48F80124 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=hotmail.com header.i=@hotmail.com header.b="LgUI1kRz" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nFU5KON7XckPXQ/zPIoveUFE5XKWMU9nI67U479W3vH8KLm7i8TNlW+W8JsV+ZH4udJHO+3zlSoVreUNu22+muNzPiNucxFZgLJ3LvfEkSsjSjCkcfE3iEqBA1m+ehr+FDB4ryPseKrfzUoU/ZjrnEs9jVevIqSz6J3uv/ihjllDUUpdlVsAcy0eGGdhKRuLfg86/7dbinQJdL5mxpzphjUeRcQW+1E18dOuCAwYUBB4JSbgow1DAvcBNw9gLzwMLKhMywcNnm1cUDCTUDHgsWaBtEez2FOlN2o4lpicu6HdmcwomQ1xNXfppjktrjrsgd6XveSOcWX/Rv+NfFQNUg== 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=xF+i1am0mqGlM4sD1vKDBc5dgMNmfc7h7SdCjtsPQl0=; b=EZWFCRRWcHh5WQr3IbXuz4W/+ibQPUDksd/MljYYLwsuQGQny9Taw5rF4RYOGV25oZExStA+RQ0Twi4B1r/t7ujYv9rUIrdkLJk4/qyqh7MqJ17OB7kDeuOYGXGf1tFDSc4zqt/Cx3TtQAbvBYOvc3O23ODnL5JFEzki/B7+HS3hEanuvNjUPAJQ0KyYvDwoVYy7q8XnQn84DSFVuSPcuj1fn8EaTA647NX3sITTy9iuj+2aFeHoMMoKw4f4Rc1pW52W9TkhrULXeALYvPtqP6Fqh4VwyHjao38uxnAxA7jwa32HRzrSmWzR/mGSF/p49F87kWR4VlOnlCDuwBwNrg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hotmail.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=xF+i1am0mqGlM4sD1vKDBc5dgMNmfc7h7SdCjtsPQl0=; b=LgUI1kRzOHF7dubTzyMO8xI19tbH/vJqXk3tO5JVbN3g6+R9oqmx/DKf3gaiQMWJOpLRaukLooGUkPABJtxvOZPs2liO0kWMycva4K35bfQkCQQXgWGsIYFGNelIvk7dycJcQ4un17CoElX46poiJbest99GBXTjccA0U+937p6o7/JP5DJ3wxtpGe+lm77eT+yz86XGOrwVl/d71j51RaZT7+UHXtN4huseFWP7Iy3PUMNOWjuuiR4yL4Q+8gUet7XryTaymjupg5A3DsRIfgZYJd5PKSU//WZLZOK94ZbC1bY3LTglCjCsCTlPdkdLeW3sqsghR9BsAQ2vGymjZQ== Received: from BN8NAM12FT062.eop-nam12.prod.protection.outlook.com (2a01:111:e400:fc66::50) by BN8NAM12HT152.eop-nam12.prod.protection.outlook.com (2a01:111:e400:fc66::438) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3955.9; Fri, 19 Mar 2021 19:13:58 +0000 Received: from SN6PR06MB5342.namprd06.prod.outlook.com (2a01:111:e400:fc66::53) by BN8NAM12FT062.mail.protection.outlook.com (2a01:111:e400:fc66::321) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3955.9 via Frontend Transport; Fri, 19 Mar 2021 19:13:58 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:578469A77F0D4F4470BFB324BF7A2416D627D4ABDB06C6A57F7F803C971CFD54; UpperCasedChecksum:0D9005D7321A0F95E4C525492FBC6DFEEB1CE35D420D923829973328AA91334B; SizeAsReceived:7531; Count:47 Received: from SN6PR06MB5342.namprd06.prod.outlook.com ([fe80::fc38:a692:c2c8:f63e]) by SN6PR06MB5342.namprd06.prod.outlook.com ([fe80::fc38:a692:c2c8:f63e%7]) with mapi id 15.20.3955.018; Fri, 19 Mar 2021 19:13:58 +0000 From: Chris Morgan To: alsa-devel@alsa-project.org Subject: [PATCH v5 3/4] dt-bindings: Add Rockchip rk817 audio CODEC support Date: Fri, 19 Mar 2021 14:13:36 -0500 Message-ID: X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210319191337.9414-1-macromorgan@hotmail.com> References: <20210319191337.9414-1-macromorgan@hotmail.com> X-TMN: [a8KuAtJ1LvODWzTNSnGxhtlDcN+dSRju] X-ClientProxiedBy: SN1PR12CA0044.namprd12.prod.outlook.com (2603:10b6:802:20::15) To SN6PR06MB5342.namprd06.prod.outlook.com (2603:10b6:805:f9::31) X-Microsoft-Original-Message-ID: <20210319191337.9414-3-macromorgan@hotmail.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from wintermute.localdomain (76.183.134.35) by SN1PR12CA0044.namprd12.prod.outlook.com (2603:10b6:802:20::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3955.18 via Frontend Transport; Fri, 19 Mar 2021 19:13:57 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 47 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: d832b206-5f14-44e6-26ce-08d8eb0b255e X-MS-Exchange-SLBlob-MailProps: FxEr8kVTuhr9YqQ01nJa/znbAevm76fKv6GkSNc/dX4T6XfKUS8OmlGfsH7A1uGskvPs+fg9+YmR79fy153AUMfetEjU5uAUNg+7p7/ojpvgWs/p+NqhyTSfIvETKUFqQGd133SAu3NzRnMRbDTehhB0m7x5CApO4IYi4niTW2gB5DztEu8fKAg6JdULiA8yNu2g3zAgFtS+UHUrRck4F81Z8gQxJt9fdF3DKwF3DKhWXsC6iI8b0tChb18dv+dDqhOmaRSDv4hKgmNa9RmdCeWMV5vHrHAHggPeh5XCXjgi9pU++TrmsuktSRLWWsEwh5m/H6+dXPHx8SzxMmvR5PG/DdAL+Gl4Bym+eLE9tHheZ+WzinGYo5CV3Hh+7Ag70ktqDVzll2PqA6miEDVLj32/OHb1U0COri+C+l/5+Y171iuoXvxbOfZDID0C/Uj8vuDv0+nXVCWBp/hh6ZEXfZuO6CqxuYKF8AefQZu0mWVW2zWKbVA6HBFgrnnnF7EVaM6Ijm3/zRELS37VbWhVeTIyuCjqulz81YGMtoa7btCMFwxfPZ0TX2gfCkoStlUvyE600QzWMQ63hcIQ9RkzPCOtPYbiC6jD+JEyaZs4V/n4WC2/h5Uj326LL6gZlBQ4kJhfuIqO/M7r1sRB9013vzKarCQmhtAabx76kJeSz2u1+94tVZIyoy1Mk2/OAOeQ5kulQ+OYbkS4xqRZJifFXSlwVNqi1cKzqpRGf0qXAvqlszI6ao+oMJI6+ZaYh+OTRUk80fYB/gdg4SiYnIP8R6YxQmXT36MSU5CCmE23CaI5KawpB4tnE9VQRv9HgXCG9VDJG6MRCiEgj6xEqpoG6cqC5LXiM5f7qXG47Jt3ovPl4GVWaAVKfIUxaNb1DCs4JAfA5xSqc3WCtNBH6wBIsyvZerL+OHWlCW0bnwsOERlEjWngxIx0y2T/U3HiYC045M+mHedr9pClvoEJMD0PApHKNl0C+Nppr1aoE93P+Scqx9v9CZb02lHtmfaRHdvlROUM4ra9ZaaJWetcuEcFQAgueu3zVG4H X-MS-TrafficTypeDiagnostic: BN8NAM12HT152: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xovgymdYR8JYNXOzacXz2BtSFS/MxrVJZkZMC0bjwFdzRHCIOr4h+OxMznCMZvmCZuzb5kCmMEXFsRbhTIhJcyhuUrRVtBuRoZfXkRQOEoh1K9F3OdPfQH5FC13tTy1CC6u2lcUEkkpce/glI9l6GaJomgWGgjuR0Ldt1gLbpsI5RIMYBKnbcr+ie8czAsRAVGliR03zxtqSkaZ4JYrKUpo1ObGgIkXP4nxcoXpC76oxX7ZjoPHc6lXmv7ZhnfEch+Apuk2lVrdHTjDJFws/cTvzccwgh35+TXUCX7BKZl4nusQZUhU/OsZvGsAWiTdNlRJ3dYxs0tZxE8bsAWT8j9H1pZ3WQwIzC4HNrwAovBtEoeeh2zJM6EXEXRMNmyGUZAwZSIN7jdbNost5P4ihuAuIHS0U50WzE8SMkLdyC3g= X-MS-Exchange-AntiSpam-MessageData: TTYJ69W3pofw0QwHBF+xKPYqpkB6f/qjbtc43EIM6u8afhR0e3tlu4kQMKYKbkRg1JgzHmrMszFxmqS4PbOv1ZTh9+kpAdEUWjwTYgZiM4DTurbvN9XeAXOpcioFPAyl2MNzu1MyeP/fgxjHpHUcAw== X-OriginatorOrg: hotmail.com X-MS-Exchange-CrossTenant-Network-Message-Id: d832b206-5f14-44e6-26ce-08d8eb0b255e X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Mar 2021 19:13:58.2946 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-AuthSource: BN8NAM12FT062.eop-nam12.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: Internet X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN8NAM12HT152 Cc: broonie@kernel.org, heiko@sntech.de, pierre-louis.bossart@linux.intel.com, Chris Morgan , tiwai@suse.com 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" Create dt-binding documentation to document rk817 codec. Signed-off-by: Chris Morgan --- .../bindings/sound/rockchip,rk817-codec.yaml | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/rockchip,rk817-codec.yaml diff --git a/Documentation/devicetree/bindings/sound/rockchip,rk817-codec.yaml b/Documentation/devicetree/bindings/sound/rockchip,rk817-codec.yaml new file mode 100644 index 000000000000..845886e2fdf4 --- /dev/null +++ b/Documentation/devicetree/bindings/sound/rockchip,rk817-codec.yaml @@ -0,0 +1,60 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/sound/rockchip-rk817.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Rockchip rk817 audio codec + +description: + The rk817 codec is an I2C codec integrated with every Rockchip + rk817 PMIC MFD. + +properties: + compatible: + enum: + - rockchip,rk817-codec + + "#sound-dai-cells": + const: 1 + + clocks: + maxItems: 1 + + clock-names: + const: "mclk" + + mic-in-differential: + description: the microphone is in differential mode. + $ref: /schemas/types.yaml#/definitions/flag + +required: + - compatible + - clocks + - clock-names + +additionalProperties: false + +examples: + - | +rk817: pmic@20 { + compatible = "rockchip,rk817"; + reg = <0x20>; + interrupt-parent = <&gpio0>; + interrupts = <7 IRQ_TYPE_LEVEL_LOW>; + pinctrl-names = "default"; + pinctrl-0 = <&pmic_int>, <&i2s_8ch_mclk>; + #sound-dai-cells = <0>; + clocks = <&cru SCLK_I2S_8CH_OUT>; + clock-names = "mclk"; + + ........ + + rk817_codec: codec { + mic-in-differential; + status = "okay"; + }; + + ........ + +}; From patchwork Fri Mar 19 19:13:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Morgan X-Patchwork-Id: 12151771 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.9 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FORGED_HOTMAIL_RCVD2,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D5192C433DB for ; Fri, 19 Mar 2021 19:16:47 +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 7C21A6197A for ; Fri, 19 Mar 2021 19:16:46 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7C21A6197A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=hotmail.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 B68561678; Fri, 19 Mar 2021 20:15:54 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz B68561678 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1616181404; bh=T5XKJI9aLzubXQKPulHC2+eDfMNiYZbj+qzeVAJFNuA=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=cD95mkF6G53ezqitQ4N13p8MatxqFUn3QE6QZPebxxUXT/8vLUCg4IMIODkaoqF5t HnoSjTP4NbLPWG4J2tpsOoZ607Zp4w5QvY5CFrou/8s5qi5kTCoyoKghwf9k2XZEaO NET2AFpEQU+HKHEerZwR/4aFnK9MZU8e+iNAaoXU= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id B8C86F80482; Fri, 19 Mar 2021 20:14:25 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 1E8E0F802E3; Fri, 19 Mar 2021 20:14:22 +0100 (CET) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12olkn2098.outbound.protection.outlook.com [40.92.23.98]) (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 ADB17F80253 for ; Fri, 19 Mar 2021 20:14:13 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz ADB17F80253 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=hotmail.com header.i=@hotmail.com header.b="RNezHFzB" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Rvx8dI9uQtmcOfu9tkN1yzs3fhkHt9oRVx4bvY3SnyuwanLmENpYMm04vPhn1Tz19LDpjZ9CrN/5SKSNjajsHd6P7rvlkFH0R2oxjf6SX89pSs2l4O60cQasdGLqho3ywEOduebYIzsXyGokNfv/xDsYOgwZ0lpLDkouyn6qPDEQD6q530gKHm9CP6QTcj8wdh2QuJUkdZw0m9iHZOq5xsMjzLBiMT1VGFIAClpJ9tFdDNILJa05x+FtV85PkTjx+nBr4Axvwh93OwhTl55Hr4iAvrJaJKZTGOTkrSfM4vV/6DOvkdbSyZd7njWCTe1YqO4ZX5cXLzatjxmHKbJYGw== 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=GuvtO9dQQBw8iP6fllwadI6ruugNJW4ZkBtN7eBuukE=; b=FKIxk5Gv0DzpPgpK5XokI5EF1JZ9dNGLKPlR7Oj4UpZ1k/e4mJ5m4iZtL7H0UYYOVaFe2rW9OeH7oV9kA+Ffx8Iw3H6yIkSJH/INbaHQITPKRBRWczQDbZehxY0fOVb0cflKHWPTEyAEzXo4cETupwWKf5wa5GYx0uWw76iqFVdSSXXqk43M5AkBjU80KDpQ5rgC5wMnzhiiNHyWlj79DINQ8u2QMrVQK+xqLt439m7atV6uy0hMDzXOdzYQKoTuzKbl62toWVyl4iVteyltNJEQG1NIjJjwWaY5Nf6HHXaRIEBl4FJutWTtb7Om0lFqg+4zHJEemiG3Xj8dad7CIg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hotmail.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=GuvtO9dQQBw8iP6fllwadI6ruugNJW4ZkBtN7eBuukE=; b=RNezHFzBTfOPhzaJqOztQbBv80G17X0b/KlISXKfhYZzdTgPUP88GE+3N9go6Oe0Aa2PZTY9CMeOoQ52vIfhZ/9HqGtvWqEdi+SgdX1SWdHrBnEnpb2xy85mfYUQ/HqreNNMTqUWcBfKEcaVBnbqDfDdoyPW0tCCNDQg8PJgNNY+asy9i2l/vKRZ1t7KnEpoZcMA+9umTjLGL+0bmWA0UG9QuGMAHvoEAF8H410+WKUrIEFAy/beFfk3dqd+q7nDDNfzfKVVEfah1GtOVPH99L3hAyIYpS6BaaVqwUeJyMx+64S94Ltg/NJpL7LzVwP9GpA3asj4jklLZ8mnMVexsg== Received: from BN8NAM12FT062.eop-nam12.prod.protection.outlook.com (2a01:111:e400:fc66::42) by BN8NAM12HT182.eop-nam12.prod.protection.outlook.com (2a01:111:e400:fc66::371) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3955.9; Fri, 19 Mar 2021 19:13:59 +0000 Received: from SN6PR06MB5342.namprd06.prod.outlook.com (2a01:111:e400:fc66::53) by BN8NAM12FT062.mail.protection.outlook.com (2a01:111:e400:fc66::321) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3955.9 via Frontend Transport; Fri, 19 Mar 2021 19:13:59 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:259F668122432ED6707CF4B2EBF307CD35350E5612882B1D7742594AE51B3E2E; UpperCasedChecksum:522E1602EEF8D27C5E7B71F36B74A59E333593138A0CF9EBA14686D39112F3DA; SizeAsReceived:7538; Count:47 Received: from SN6PR06MB5342.namprd06.prod.outlook.com ([fe80::fc38:a692:c2c8:f63e]) by SN6PR06MB5342.namprd06.prod.outlook.com ([fe80::fc38:a692:c2c8:f63e%7]) with mapi id 15.20.3955.018; Fri, 19 Mar 2021 19:13:59 +0000 From: Chris Morgan To: alsa-devel@alsa-project.org Subject: [PATCH v5 4/4] arm64: dts: rockchip: add rk817 codec to Odroid Go Advance Date: Fri, 19 Mar 2021 14:13:37 -0500 Message-ID: X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210319191337.9414-1-macromorgan@hotmail.com> References: <20210319191337.9414-1-macromorgan@hotmail.com> X-TMN: [lo/L+bFywOhKr0xfsaScNPWGlfr08sy+] X-ClientProxiedBy: SN1PR12CA0044.namprd12.prod.outlook.com (2603:10b6:802:20::15) To SN6PR06MB5342.namprd06.prod.outlook.com (2603:10b6:805:f9::31) X-Microsoft-Original-Message-ID: <20210319191337.9414-4-macromorgan@hotmail.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from wintermute.localdomain (76.183.134.35) by SN1PR12CA0044.namprd12.prod.outlook.com (2603:10b6:802:20::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3955.18 via Frontend Transport; Fri, 19 Mar 2021 19:13:58 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 47 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: 1ce57db3-3627-4198-337e-08d8eb0b2618 X-MS-Exchange-SLBlob-MailProps: zswcL9HXbeXsGxgxUGH+YTsWg2A96AcwnIOx/dBnQsrOkgZYjFa85BBezSd0UhgZG02bWlkI1R58fU8+XVLDIKCUifeUJmIMDZWdN7z2iMBvAf5S5e3YBMiGdgMG7aFFPVwc9R1hGX0E2irvKLPzqG6j8bu5BwRUk7Bp4ExN/usMGBi5JRholH3vWyzZHqGuuNYcgoMtGL0foUGXYKfJ8KtayIgWqHjp6a5ECYCKCqbr9xTZvCBgfnjNmMDOp7M4EaDny+ataGLafSOYbwBDdDw2eHN2GrE019GJu4zGKWCvXAJKMmbFqVFoBXg/WrtUq/pkHRSyqiyycrTOPYcdwj2KgAGMVEICd3A2aNaRQFhHa6zIHpYDDfk+cuCgiJYtiKXNR5iVpiGM1Bw5EMMS0X2FK8ofQQvkyYi5lxSqhgH2fPi7JeR5rVdorP+l5I3tmvdKhDAqyFrsdVahScpazo+trIcAocLUzgiiRcoB7jbNTCtE8h6stdGJPyesud52q42n2VG/Kh+JJt8+FYlQAosc0oXe5AZTJC21cD6Ao784+KCvhK3z4RSqUmDg3yVfcARxoTsuLJ3DbgGvFnXsKe7JuOsfxFSUC567sIqLf/gsYQAS8ow1i4bnUF6keIayOuA3Jru6yKPOMIJ6kBVt05uQNCcmEm6dDyxUAVAV+oWEtrkTKciLgFu5HfygP6xOdU9F9bZF6eElL4F8zLjI6oe3xg8X3T8gMss6OfiVRt8IiNVfjO4KMQP0t39QcVug X-MS-TrafficTypeDiagnostic: BN8NAM12HT182: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: yP9uAN7Enhxj8LoxMRyiJ6MjIwpPTIp2whdu25uuk4ih/PxkMN6AATIZ/HneoRb0qPSvPsomhemYiPdstsLO5anlZ3zeb9DJMBSXwrsKE2+SFOZ+uZp4xQeDYO2KI0hK5b93UTVFqKvMerwWjElLKtuoexZTZ9BypGC42Zjvpk+xfwnNiTSGEe4ACh10sLxcXlXA1QGedx81rX2ceitDzjmsuNXDMYE9s14FYWKFG5PKcQ/v0jBJ4B61ua0IJ5UyDCAXinhOiWLZljSy0A8aweetUab7eWwp7d4STnyRLLKmmNsaeHQxzEFdzCfNeIIDnyhObWNoEbOEvVg623YvZ6kdUwI0q6eXvgyom9yF/TJp2PUgMeGsE/loJ05uWf43hXmH7PJngCTdLeLVKW81gQ== X-MS-Exchange-AntiSpam-MessageData: WWI1LytkMmG7JPBYK6n+f96fPwnlZwUt9ugmWis51UerULCnpghYNRNmsQd8rmJ5W4iQnZm8Kp6xfl76jhtpOswz7zGrnF5vICoM0huucXOh1hJz3tklpnnH+tvjzAINvB5DFCSu/E3awDN0rK8ujg== X-OriginatorOrg: hotmail.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1ce57db3-3627-4198-337e-08d8eb0b2618 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Mar 2021 19:13:59.3450 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-AuthSource: BN8NAM12FT062.eop-nam12.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: Internet X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN8NAM12HT182 Cc: broonie@kernel.org, heiko@sntech.de, pierre-louis.bossart@linux.intel.com, Chris Morgan , tiwai@suse.com 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" Add the new rk817 codec driver to the Odroid Go Advance. Signed-off-by: Chris Morgan --- .../boot/dts/rockchip/rk3326-odroid-go2.dts | 35 ++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/arch/arm64/boot/dts/rockchip/rk3326-odroid-go2.dts b/arch/arm64/boot/dts/rockchip/rk3326-odroid-go2.dts index 97fb93e1cc00..e48dcf430efc 100644 --- a/arch/arm64/boot/dts/rockchip/rk3326-odroid-go2.dts +++ b/arch/arm64/boot/dts/rockchip/rk3326-odroid-go2.dts @@ -161,6 +161,29 @@ blue_led: led-0 { }; }; + rk817-sound { + compatible = "simple-audio-card"; + simple-audio-card,format = "i2s"; + simple-audio-card,name = "rockchip,rk817-codec"; + simple-audio-card,mclk-fs = <256>; + simple-audio-card,widgets = + "Microphone", "Mic Jack", + "Headphone", "Headphones", + "Speaker", "Speaker"; + simple-audio-card,routing = + "MICL", "Mic Jack", + "Headphones", "HPOL", + "Headphones", "HPOR", + "Speaker", "SPKO"; + simple-audio-card,hp-det-gpio = <&gpio2 RK_PC6 GPIO_ACTIVE_HIGH>; + simple-audio-card,cpu { + sound-dai = <&i2s1_2ch>; + }; + simple-audio-card,codec { + sound-dai = <&rk817>; + }; + }; + vccsys: vccsys { compatible = "regulator-fixed"; regulator-name = "vcc3v8_sys"; @@ -266,10 +289,13 @@ rk817: pmic@20 { interrupt-parent = <&gpio0>; interrupts = ; pinctrl-names = "default"; - pinctrl-0 = <&pmic_int>; + pinctrl-0 = <&pmic_int>, <&i2s1_2ch_mclk>; wakeup-source; #clock-cells = <1>; clock-output-names = "rk808-clkout1", "xin32k"; + clocks = <&cru SCLK_I2S1_OUT>; + clock-names = "mclk"; + #sound-dai-cells = <0>; vcc1-supply = <&vccsys>; vcc2-supply = <&vccsys>; @@ -428,6 +454,11 @@ regulator-state-mem { }; }; }; + + rk817_codec: codec { + mic-in-differential; + status = "okay"; + }; }; }; @@ -439,6 +470,8 @@ &i2c1 { /* I2S 1 Channel Used */ &i2s1_2ch { + resets = <&cru SRST_I2S1>, <&cru SRST_I2S1_H>; + reset-names = "reset-m", "reset-h"; status = "okay"; };