From patchwork Wed Aug 12 03:22:30 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zidan Wang X-Patchwork-Id: 6995451 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 47F599F344 for ; Wed, 12 Aug 2015 03:21:04 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4A71F206D6 for ; Wed, 12 Aug 2015 03:21:03 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id EF568206D2 for ; Wed, 12 Aug 2015 03:21:01 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id C1EB82606BF; Wed, 12 Aug 2015 05:21:00 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Status: No, score=-2.6 required=5.0 tests=BAD_ENC_HEADER,BAYES_00, RCVD_IN_DNSWL_LOW, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id C2C4F260623; Wed, 12 Aug 2015 05:20:52 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id B5494260623; Wed, 12 Aug 2015 05:20:51 +0200 (CEST) Received: from na01-bl2-obe.outbound.protection.outlook.com (mail-bl2on0112.outbound.protection.outlook.com [65.55.169.112]) by alsa0.perex.cz (Postfix) with ESMTP id 39D0A2605E8 for ; Wed, 12 Aug 2015 05:20:44 +0200 (CEST) Received: from BN3PR0301CA0032.namprd03.prod.outlook.com (10.160.180.170) by BN3PR0301MB1251.namprd03.prod.outlook.com (10.161.207.27) with Microsoft SMTP Server (TLS) id 15.1.225.19; Wed, 12 Aug 2015 03:20:42 +0000 Received: from BN1AFFO11FD042.protection.gbl (2a01:111:f400:7c10::179) by BN3PR0301CA0032.outlook.office365.com (2a01:111:e400:4000::42) with Microsoft SMTP Server (TLS) id 15.1.225.19 via Frontend Transport; Wed, 12 Aug 2015 03:20:42 +0000 Authentication-Results: spf=fail (sender IP is 192.88.158.2) smtp.mailfrom=freescale.com; freescale.mail.onmicrosoft.com; dkim=none (message not signed) header.d=none; Received-SPF: Fail (protection.outlook.com: domain of freescale.com does not designate 192.88.158.2 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.158.2; helo=az84smr01.freescale.net; Received: from az84smr01.freescale.net (192.88.158.2) by BN1AFFO11FD042.mail.protection.outlook.com (10.58.52.253) with Microsoft SMTP Server (TLS) id 15.1.243.9 via Frontend Transport; Wed, 12 Aug 2015 03:20:41 +0000 Received: from b50113.ap.freescale.net (b50113.ap.freescale.net [10.192.241.89]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id t7C3KbGP013468; Tue, 11 Aug 2015 20:20:38 -0700 From: Zidan Wang To: Date: Wed, 12 Aug 2015 11:22:30 +0800 Message-ID: X-Mailer: git-send-email 1.9.1 X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11FD042; 1:TnkIlP8fCe0IWNVh9idxXkSdBuJbe/x5A0Xny4rsyAhCpfYBLwrulBsYDnLkUtunh8mC/ddB7QS//WeuINDv+d0siNybv8EWs+5BvuGtos/kuRne1Z/i2Fvilu+FxdvHjLpgH4yx4r5qH0od5ORnrA+8F1RagsALL+NcaGa8amMlJmmMrjC6x5qd0g7nCx8UnJhmqPrKqcM5FqnJJryuTnG3v7Ob2uDnkgJWQw+/vJcP/XMrHBtXrc1uDVMYRjbr7VIaL5io3brspAvPeCrdiKU6e4TkshF7K7Hck9xfrj4s/yS0O3+fst9giRTaWgncpXQRlZpKTsgJTi0w3wPnT+N7P+9lfYgMxhCbzLHynk51Nv2s9JB5CEwVX7eeFnbSwPJaDCo6ybRVeev2JsxrKWM+2MEXF7RDakHCbTPVRRs= X-Forefront-Antispam-Report: CIP:192.88.158.2; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10019020)(6009001)(2980300002)(1060300003)(339900001)(3050300001)(199003)(189002)(47776003)(4290100001)(92566002)(5001960100002)(19580405001)(97736004)(110136002)(69596002)(5001830100001)(77096005)(48376002)(85426001)(81156007)(19580395003)(5003940100001)(6806004)(106466001)(86362001)(87936001)(575784001)(4001540100001)(107886002)(105606002)(46102003)(33646002)(5001860100001)(50226001)(64706001)(68736005)(50986999)(36756003)(50466002)(2351001)(110436001)(62966003)(230783001)(229853001)(118296001)(104016003)(77156002)(4001430100001); DIR:OUT; SFP:1102; SCL:1; SRVR:BN3PR0301MB1251; H:az84smr01.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; MIME-Version: 1.0 X-Microsoft-Exchange-Diagnostics: 1; BN3PR0301MB1251; 2:7Zsktk90IBZGeVF/ns5zDoUWYD2Pv++Cw0bumU3HD2j5kDrf4HojTXzvQClXmObTQYxfpJ25tT5qCQ0VoZn2LyPZrFnsw1CbacK2KwiLeVEJ4F30ZDXJpVLRxY7yTJnrKiZqNo6QYGi09T9kFJvXUcprAaPbKTyYw4TbBLrAeWA=; 3:/3kVhkmZiZPabq4hwFjo7xJ3T2BSRvYf9a75y3llDenKePn4FoJkd8AGxD8T4YdITbXdiMT3onCxcQfYj0BL0/6dpwAH+4zwhFp9C6aQgkhKgI6oDs2jKgagkurJFQ+p9Vuy/qnTL1tDFwY9sgipL2VTkGppHYKR1yP3wMPkmOrtq3rcwkh2hYwtKlG5rmLFYcKb5YeK2jJW+DJvMp7hhvVquvycrMSwV76tfjA49S4=; 25:JyGj4e9gpZoGqY5NnJJtyiInkH/tzFERv/gV3rNlmV1T2iNgOCfoHF/lYCSrNXIVjPDmFyD76rEBIUYeFEppueZoZCDwL6oCxkoewlF5QQxRWa44HBRBaPUzQYmQgcbvj4pNuGzHwbc2hgO+1ZUbMmJ20AjBiO8Fows0/qMJzA7htUEANUvG+Vztoz0JcM+N+kW/YqtvYjjTcuEdse3ziyJnBRKGSFc7BmrrmpuylGRswDeOQ8dcOTJSrPcwH3cggZSPao/9GZNNscpByPXVNg== X-Microsoft-Antispam: UriScan:;BCL:1;PCL:0;RULEID:;SRVR:BN3PR0301MB1251; X-Microsoft-Exchange-Diagnostics: 1; BN3PR0301MB1251; 20:f+0wLJJAndtFCOn3vCUiO0KOHUKHpmM9/qWBiA/um+tE2K83wBSh3UH9JRK8UCMq1cizoAuXcfFccwANUI69hP8cstnDqdhrXxBE0oxIL9ey5ALFenawZG7r8sJWhSuxLcK7wD8bV1jf+JV1B7tTSbNRBcUHzzO7vJ5+nD95PLaNt1BhlOxzeAP6rW7EIdV6vCXxUpXfDbIy/7RNgt/k32GAgju7hieN5hzFUZNHMykaSHWESbIFCqCDTafR0ZTQT/8iPswWD7/rjFhQFkAndZ0/YBWmzndlNQyzEy/k77tRd2XNVCJPeIt0HeYARVErK+pZRpaSErs/O18tImau2snrQ8orrl1pXMY0kUsti34=; 4:uy72TtuFaQfEp32tWftPXJbZ9pySxyS0BKqn8XF/7DwDt6SlnIx8b4G/Q5gPwD4LA2SyRwe1TaTmOei81Qz774716EFy3xQ2bKCiyrBfL8w64nfSFuT+Ddcvu70y8QCu2fYbxC2la4Q60/ubEEIT9+2OLGDqgtAvTOwwXUTzJFAJUR10eNGoR57OMP6iLeiio4FJQYvsdUnbeCyqltAFHFpouu/UnX1CsyfMB5wd3+NOAsGGrYmDeXilctnMHOhxH/flKmWNlXf401tiSjriS1NeFIXquaUbe+2icSRVcc5oKGPL+9iIFATtKBJKqYtY X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:1; PCL:0; RULEID:(601004)(5005006)(1201001)(3002001); SRVR:BN3PR0301MB1251; BCL:1; PCL:0; RULEID:; SRVR:BN3PR0301MB1251; X-Forefront-PRVS: 0666E15D35 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN3PR0301MB1251; 23:wPYFe7/jIWv3H1ppnJo7IBUKfstgbq52bnyyXgX?= =?us-ascii?Q?UxaQeByFU3Wabvbg0k4F/XZGfeFjJcfMmq/5hCqk9iMk3okY+mSBjodYcsuk?= =?us-ascii?Q?mO0tpcNRXv1KuQkZXcmrH0yKkKw0SlyJEEbKjKcGg8qCZgH24PhJj8Ni2VIY?= =?us-ascii?Q?onwFMiRYjVY3SLLCswq75pHC820ETcx+cC53Y9RWN6KVzUT3EGOLichq8hAm?= =?us-ascii?Q?LsYufPmRIGdl+KRwkcXc1yoFcX3JhUO10gVRv/O6mHxS4y8EcnYEDb/5SzW1?= =?us-ascii?Q?coEKhfCTt75+nWVY/0k/zzoEuRUS0A9/Lt1LYcGrPyXiGBVaY36GY2z+jmQB?= =?us-ascii?Q?uFnMl7BX6Q9HGLoxKwX4EFcM99Tdiuxo8xiIj7GM9u+evCI8QesnBUqGqeA2?= =?us-ascii?Q?iBNBe04vdsTvq/nLYfy+dAfATvYXgIFtC96LOI926s/Joz/jpGFERqRpwpZT?= =?us-ascii?Q?DpicmFWo27KHC42o8TeTQUNtZfq+6dS0YWfzBMZ+OrvnYRg32U2rKQDTa9Bq?= =?us-ascii?Q?iMXt/S1cz/B9j+SEJ19ujX77nq8WZepAhNV2dWQ0ohSPGlLSJBI22BK28+7+?= =?us-ascii?Q?lGAqUANYWGI8+JuZeF1eHwP4rzhH3aSx3uQ2utRg4loCd1tIKB0j0RdxRkjT?= =?us-ascii?Q?6RSVYeJHP49bzMrMqg6rC5eD4oBYo6Jz46IbmGHTxlHj+ZNbgynzkg7vJdb3?= =?us-ascii?Q?IK1L1Gm2Y0nF6v6WTOT8dFn/SyCoYsu96Kjt56XIYNzg/eeu40vxZ9nO6SOF?= =?us-ascii?Q?ivWmvvAwLmP4fJ/5SOcHPv/Sj3LDlO8Fh/u6LTuY7lb/sKUA1otUrO5W3cd3?= =?us-ascii?Q?JpogB0E0M/mCuSvPdznQHIPPgqXDo0lCG0Wqb5Qi6vBlfsKJLXQNzua0mQSe?= =?us-ascii?Q?6nM3e9seefNKjH00OWTRIuj2G00el98gmSwe8I1XwsyF6rYga8KnMpd1cPbr?= =?us-ascii?Q?FMvFF9F2VP6qjb28uz6MSDqjmJh5itm9BFKzTEo7dOCkDAs4i0jFjt6d31Ei?= =?us-ascii?Q?owy+dZfY3xzIu79mDLjcN8fXULwZnt4jdhcWpFwK8UWq8Dy6TgsTJ7QvVKEq?= =?us-ascii?Q?tdM4irT7r2zIzFcMj2i4PyqGrF0pIQxSwsGh35GwkN1NWxEjqGh1QhRiBo6V?= =?us-ascii?Q?X8JuVsyQr3anMaz6iTb1aqrc/X/z2hjvislHyaOclwUVpc/BA3EsISeasUYe?= =?us-ascii?Q?taKbH+r2L91aatiwM9i3zllq7yj8m9L4ujcCjkPGO0AhkHFOwyuwknM4Ulea?= =?us-ascii?Q?uHN/C4ch+ht4pjjIdXH42mKpxMIx3Uev/LaboTzY1?= X-Microsoft-Exchange-Diagnostics: 1; BN3PR0301MB1251; 5:mVdcm8kF3S6Mfg7UcS21dBF98miPqhALptvrHcfDhyuFHnt8oDXypx9F/gmL4Mvj1Rc8S6ca/TQa95GbBaWcOoEpZCntR6k5emOTUw0P9iRAzsIMApZdbCzR08PimNIf7lmz2PQ04Mp7f8BRMwpxrg==; 24:JQbevhTkebzq4eTlEk7cv/HMFU1Ar7f0SLBcBdJI7HUo+hxHVMqDv0+MX+8ok0WQTvwduZYbM5beo5Zqrb08xN0Ksh5vOrXfQoXKT3A6fnE=; 20:u35tSLMkzaEMW2qavzmFSL/Q7gqJLShqYA9pwn72gex/dQuOdRlvqsuetxfdLBNfI50/yZNt1M+g2Nvvkpysfw== X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Aug 2015 03:20:41.5344 (UTC) X-MS-Exchange-CrossTenant-Id: 710a03f5-10f6-4d38-9ff4-a80b81da590d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=710a03f5-10f6-4d38-9ff4-a80b81da590d; Ip=[192.88.158.2]; Helo=[az84smr01.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN3PR0301MB1251 Cc: alsa-devel@alsa-project.org, Zidan Wang , tiwai@suse.com, timur@tabi.org, broonie@kernel.org Subject: [alsa-devel] [PATCH] ASoC: fsl-asoc-card: add wm8960 support X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 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-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP add wm8960 support for fsl-asoc-card Signed-off-by: Zidan Wang --- .../devicetree/bindings/sound/fsl-asoc-card.txt | 2 ++ sound/soc/fsl/fsl-asoc-card.c | 37 ++++++++++++++++++++-- 2 files changed, 36 insertions(+), 3 deletions(-) diff --git a/Documentation/devicetree/bindings/sound/fsl-asoc-card.txt b/Documentation/devicetree/bindings/sound/fsl-asoc-card.txt index a96774c..fa0a10d 100644 --- a/Documentation/devicetree/bindings/sound/fsl-asoc-card.txt +++ b/Documentation/devicetree/bindings/sound/fsl-asoc-card.txt @@ -59,6 +59,8 @@ Optional properties: - audio-asrc : The phandle of ASRC. It can be absent if there's no need to add ASRC support via DPCM. + - gpr : The gpr handle + Example: sound-cs42888 { compatible = "fsl,imx-audio-cs42888"; diff --git a/sound/soc/fsl/fsl-asoc-card.c b/sound/soc/fsl/fsl-asoc-card.c index de43887..c058e68 100644 --- a/sound/soc/fsl/fsl-asoc-card.c +++ b/sound/soc/fsl/fsl-asoc-card.c @@ -16,6 +16,7 @@ #include #include #include +#include #include "fsl_esai.h" #include "fsl_sai.h" @@ -23,6 +24,7 @@ #include "../codecs/sgtl5000.h" #include "../codecs/wm8962.h" +#include "../codecs/wm8960.h" #define RX 0 #define TX 1 @@ -90,6 +92,7 @@ struct fsl_asoc_card_priv { u32 asrc_format; u32 dai_fmt; char name[32]; + struct regmap *gpr; }; /** @@ -400,7 +403,7 @@ static int fsl_asoc_card_late_probe(struct snd_soc_card *card) static int fsl_asoc_card_probe(struct platform_device *pdev) { - struct device_node *cpu_np, *codec_np, *asrc_np; + struct device_node *cpu_np, *codec_np, *asrc_np, *gpr_np; struct device_node *np = pdev->dev.of_node; struct platform_device *asrc_pdev = NULL; struct platform_device *cpu_pdev; @@ -443,6 +446,22 @@ static int fsl_asoc_card_probe(struct platform_device *pdev) if (asrc_np) asrc_pdev = of_find_device_by_node(asrc_np); + gpr_np = of_parse_phandle(np, "gpr", 0); + if (gpr_np) { + priv->gpr = syscon_node_to_regmap(gpr_np); + if (IS_ERR(priv->gpr)) { + ret = PTR_ERR(priv->gpr); + dev_err(&pdev->dev, "failed to get gpr regmap\n"); + goto fail; + } + /* + * for imx6ul we should set SAI2_MCLK_DIR to enable + * codec MCLK + */ + if (of_device_is_compatible(np, "fsl,imx6ul-evk-wm8960")) + regmap_update_bits(priv->gpr, 4, 1 << 20, 1 << 20); + } + /* Get the MCLK rate only, and leave it controlled by CODEC drivers */ codec_clk = clk_get(&codec_dev->dev, NULL); if (!IS_ERR(codec_clk)) { @@ -475,6 +494,11 @@ static int fsl_asoc_card_probe(struct platform_device *pdev) priv->codec_priv.fll_id = WM8962_SYSCLK_FLL; priv->codec_priv.pll_id = WM8962_FLL; priv->dai_fmt |= SND_SOC_DAIFMT_CBM_CFM; + } else if (of_device_is_compatible(np, "fsl,imx-audio-wm8960")) { + priv->card.set_bias_level = fsl_asoc_card_set_bias_level; + priv->codec_priv.fll_id = WM8960_SYSCLK_AUTO; + priv->codec_priv.pll_id = WM8960_SYSCLK_AUTO; + priv->dai_fmt |= SND_SOC_DAIFMT_CBM_CFM; } else { dev_err(&pdev->dev, "unknown Device Tree compatible\n"); return -EINVAL; @@ -521,7 +545,10 @@ static int fsl_asoc_card_probe(struct platform_device *pdev) /* Normal DAI Link */ priv->dai_link[0].cpu_of_node = cpu_np; priv->dai_link[0].codec_of_node = codec_np; - priv->dai_link[0].codec_dai_name = codec_dev->name; + if (strstr(codec_dev->name, "wm8960")) + priv->dai_link[0].codec_dai_name = "wm8960-hifi"; + else + priv->dai_link[0].codec_dai_name = codec_dev->name; priv->dai_link[0].platform_of_node = cpu_np; priv->dai_link[0].dai_fmt = priv->dai_fmt; priv->card.num_links = 1; @@ -530,7 +557,10 @@ static int fsl_asoc_card_probe(struct platform_device *pdev) /* DPCM DAI Links only if ASRC exsits */ priv->dai_link[1].cpu_of_node = asrc_np; priv->dai_link[1].platform_of_node = asrc_np; - priv->dai_link[2].codec_dai_name = codec_dev->name; + if (strstr(codec_dev->name, "wm8960")) + priv->dai_link[2].codec_dai_name = "wm8960-hifi"; + else + priv->dai_link[2].codec_dai_name = codec_dev->name; priv->dai_link[2].codec_of_node = codec_np; priv->dai_link[2].cpu_of_node = cpu_np; priv->dai_link[2].dai_fmt = priv->dai_fmt; @@ -578,6 +608,7 @@ static const struct of_device_id fsl_asoc_card_dt_ids[] = { { .compatible = "fsl,imx-audio-cs42888", }, { .compatible = "fsl,imx-audio-sgtl5000", }, { .compatible = "fsl,imx-audio-wm8962", }, + { .compatible = "fsl,imx-audio-wm8960", }, {} };