From patchwork Thu Dec 10 11:02:49 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zidan Wang X-Patchwork-Id: 7818271 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id AFDF5BEEE1 for ; Thu, 10 Dec 2015 11:20:21 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A38D1205B3 for ; Thu, 10 Dec 2015 11:20:20 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 3F13220595 for ; Thu, 10 Dec 2015 11:20:19 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 15978265467; Thu, 10 Dec 2015 12:20:18 +0100 (CET) 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 [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 74C90265483; Thu, 10 Dec 2015 12:14:31 +0100 (CET) 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 73C9D26546B; Thu, 10 Dec 2015 12:14:29 +0100 (CET) Received: from na01-bn1-obe.outbound.protection.outlook.com (mail-bn1on0113.outbound.protection.outlook.com [157.56.110.113]) by alsa0.perex.cz (Postfix) with ESMTP id CF85A2665B1 for ; Thu, 10 Dec 2015 12:00:42 +0100 (CET) Received: from BY2PR03CA002.namprd03.prod.outlook.com (10.255.93.19) by DM2PR0301MB1263.namprd03.prod.outlook.com (10.160.219.28) with Microsoft SMTP Server (TLS) id 15.1.355.16; Thu, 10 Dec 2015 11:00:40 +0000 Received: from BY2FFO11FD031.protection.gbl (10.255.93.4) by BY2PR03CA002.outlook.office365.com (10.255.93.19) with Microsoft SMTP Server (TLS) id 15.1.337.19 via Frontend Transport; Thu, 10 Dec 2015 11:00:40 +0000 Authentication-Results: spf=permerror (sender IP is 192.88.158.2) smtp.mailfrom=freescale.com; freescale.mail.onmicrosoft.com; dkim=none (message not signed) header.d=none; freescale.mail.onmicrosoft.com; dmarc=none action=none header.from=freescale.com; Received-SPF: PermError (protection.outlook.com: domain of freescale.com used an invalid SPF mechanism) Received: from az84smr01.freescale.net (192.88.158.2) by BY2FFO11FD031.mail.protection.outlook.com (10.1.14.196) with Microsoft SMTP Server (TLS) id 15.1.346.13 via Frontend Transport; Thu, 10 Dec 2015 11:00:40 +0000 Received: from b50113.ap.freescale.net (b50113.ap.freescale.net [10.192.241.29]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id tBAB0WBa007431; Thu, 10 Dec 2015 04:00:37 -0700 From: Zidan Wang To: Date: Thu, 10 Dec 2015 19:02:49 +0800 Message-ID: <1449745370-18960-2-git-send-email-zidan.wang@freescale.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1449745370-18960-1-git-send-email-zidan.wang@freescale.com> References: <1449745370-18960-1-git-send-email-zidan.wang@freescale.com> X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11FD031; 1:K8g+nYgWHojxaO1qbAP0K7RUIREtL9QZHTYGDIyJ5LAB58yL0tDmsRrzjLLRCt2mkZm/fJInzMXJVv17+7hzh/8qwM0d6HVaLmtev1prKqIxWI5cDm3/5oQcMRMCCaDZBf8yLTu8gRXodj6ELJGz12Ub0g7BfNUvgt6tpDqXb8gYhmd2f3zJV3bUaTtSMhs3FdVwnNL1Y1ljt8rIEFr9GrHG+rtUpmeANiJx2nElrJ7bFhAUyecMpLWVY9vx76m26crgRXd33cf/zGy1m/Hl6vu0g/Aq/hqb7VkstJQ2jI7d/wCoybS0KnZtVln5Xwl+neHAJp3NHO3wY2ZS7V1eUU+4XpLO/Mas5SdvoYjs83LnIr7b6ct6yHieIQaI3ZtSSvrO4bb8v8SpAcIK3Ke2WH1nIziqDp0BYHT/WqIX4+E= X-Forefront-Antispam-Report: CIP:192.88.158.2; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10019020)(6009001)(2980300002)(448002)(189002)(199003)(50466002)(19580405001)(48376002)(77096005)(92566002)(33646002)(19580395003)(85326001)(2351001)(229853001)(69596002)(2950100001)(1096002)(6806005)(36756003)(97736004)(11100500001)(4001430100002)(107886002)(5001960100002)(189998001)(104016004)(110136002)(50226001)(5008740100001)(81156007)(1220700001)(5003940100001)(47776003)(50986999)(76176999)(87936001)(106466001)(86362001)(586003); DIR:OUT; SFP:1102; SCL:1; SRVR:DM2PR0301MB1263; H:az84smr01.freescale.net; FPR:; SPF:PermError; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; MIME-Version: 1.0 X-Microsoft-Exchange-Diagnostics: 1; DM2PR0301MB1263; 2:wZwtzxl+ILSCRlU2dDAlm6INxHd2L64zUNCvV3wembtc8ojzYTfoHaXF8cro2VIWod7lsrTBX4cU68NgaMSh6ZGetNFTXQgotJzY/7aBojvKnlpZolHCn56ya7BXHcdwU5rbdax10bm89LjOU6NAYg==; 3:fqhiRJhUM7EG5JqgLT6mNUTRrON25cPSUvXy8PraWQ+LOcW+i5viECEOgHKqr8Y9PSKQz9tFio+V4BnndY9U7LmSxMoMkWk2VFQhvl/3N9ge6YxM8z1UZ22srSJHIV0mIDBEAYILLjaegeM21YM54VZrhswcoxRSChtTv4Xxkqc/P/WC+++z+GUcV4afjINS/qlaPy/7KwWXxlKvxhwRn5B3/e0VIDBoXDN0o7sWBg4=; 25:8WBwyvqEPzdSx/mss3pJDPPl7clZ+h63ZyAhoACasUdYn3vyXjpLVwjajselq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GMvXW6SP6B072d3+IxJ0U0= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(101931422205132); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(520078)(8121501046)(5005006)(10201501046)(3002001); SRVR:DM2PR0301MB1263; BCL:0; PCL:0; RULEID:; SRVR:DM2PR0301MB1263; X-Forefront-PRVS: 078693968A X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM2PR0301MB1263; 23:VY0sFkn6FX6+Hc8hZXBVIABJyZk8cEepwRrgOnN?= =?us-ascii?Q?pkGbdDddbzYAxAJTYJMrB2oAdTtRHKkoSFJv0zXLpPIHemm0G+xLgPWAJOqD?= =?us-ascii?Q?LTxY7FA206i0xVd26qsz72wYvpKuckecR7gTfpYDWoADjthI7LXFxGh4uoi7?= =?us-ascii?Q?XmhwCIOU+el6EQJqVQPv543k3NRHSNuGg/VdYVJK3obWvJjvsEZbzxN8Btmm?= =?us-ascii?Q?JqwOhC3v52iQuIxh1ofoXLXj1yawqZQ9i2YEQwX4Gqugi0hiCo9li060cz1l?= =?us-ascii?Q?B7qgMOGb/jd0NtCg+LaMJDZ9VDJURH5YhrrbZP2kkKglnmgSepuSLNt5Gwyc?= =?us-ascii?Q?h6oaEaefLCHae7yg2D5xMgk1hkE/4vRB/vpVKUGImrnJz5VhVSgFSht6mgyV?= =?us-ascii?Q?dF0OzL0W5Vz+oI2yA0q4WIKrNWUGUYzYNuY+IhAoXj74HwYrd7sKC6BpNfAN?= =?us-ascii?Q?O7Lp2vofwPFEkiiSq27pr5Hof7Lbugva7xTwxspbR3ytaajaEe8bGipRIU5v?= =?us-ascii?Q?r+Zlh2BqA3rZt0xg9uYwOqBVazHA7rJOEqP3MIK+OREzdiVnIh9iEX24cy8u?= =?us-ascii?Q?q3PE6rmOBDCtOQ1VSX9igQtKbj/AqCOOzca7glOt34QI+Z/fCN/M46bJcWc0?= =?us-ascii?Q?xzFusLznYfCnOUCMCvrw8u5yu2NJo+qxeXFnlUK4O9p8X1BeQTH9EA4szuUs?= =?us-ascii?Q?0Fgb/vX+eX6gjelo30/bwsUEMQxjxN/rgxDnxpRvTFEPnTvaCGE4e1TeNHD2?= =?us-ascii?Q?oYDRrWqSC5rh1tzeZl4STnjbl2f0p1tZDlwpsG9StVm3Rx5GSUDh/jkdGQ4c?= =?us-ascii?Q?qoY/kD5zHyf/Wjl0nZmufdnSuI/lEb+CiHqVyZDEUGVM0P+B62JAg+ArW0Nc?= =?us-ascii?Q?4USdI3b2X6K/uI7PAoCcqixat667FiKmLOVqNuMV+M35KUJjDEw2bx9MZALH?= =?us-ascii?Q?WiAP6DWe3bXYpcDs79mCAGkp7IALo7kTAfQyhEVg6vLmuZQTlkfg02Vp494Z?= =?us-ascii?Q?DYNsZ2SB3pwLDk8ojKGfw6H6pFHRXLCYx1pigmCNa4QdKhRw6Yi27jcJAnfe?= =?us-ascii?Q?Gv7uhVkf/kO5v/U94LRXm9KCWSwXH?= X-Microsoft-Exchange-Diagnostics: 1; DM2PR0301MB1263; 5:aSm5BllWhNY1Le06ZuqXpGUW4eEhJo8SZjUqUu9BGxsaBenzeVpdH5g5uDvAvxtQa+rlD4jX64tDMLiVJKtWw+1H9KAg0OIjDHVebCyCRHeqzUnh/ro6ei6hmmjNLt4vAdsUZ5blEUhSnQownDpTGQ==; 24:AnsBDF3lxhInxVuioX3feTQWlM/MNOMfaOOkrBuBdwKWO2FZmKeE5xpIe6HYMAZMkBZGZBM0er1itxdWe2MSWGMRyszFRrIYNUUk7iYWnkE= X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Dec 2015 11:00:40.2160 (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: DM2PR0301MB1263 Cc: alsa-devel@alsa-project.org, Zidan Wang , Xiubo.Lee@gmail.com, tiwai@suse.com, nicoleotsuka@gmail.com Subject: [alsa-devel] [PATCH] ASoC: fsl_asrc: add support for 8-30kHz output sample rate 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 8kHz, 11.025kHz, 16kHz, 22.05kHz output sample rate support. According referance menual, "Limited support for the case when output sampling rates is between 8kHz and 30kHz. The limitation is the supported ratio (Fsin/Fsout) range as between 1/24 to 8." Signed-off-by: Zidan Wang --- sound/soc/fsl/fsl_asrc.c | 39 +++++++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/sound/soc/fsl/fsl_asrc.c b/sound/soc/fsl/fsl_asrc.c index 942e74bc..cf17a1f 100644 --- a/sound/soc/fsl/fsl_asrc.c +++ b/sound/soc/fsl/fsl_asrc.c @@ -31,21 +31,21 @@ dev_dbg(&asrc_priv->pdev->dev, "Pair %c: " fmt, 'A' + index, ##__VA_ARGS__) /* Sample rates are aligned with that defined in pcm.h file */ -static const u8 process_option[][8][2] = { - /* 32kHz 44.1kHz 48kHz 64kHz 88.2kHz 96kHz 176kHz 192kHz */ - {{0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0},}, /* 5512Hz */ - {{0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0},}, /* 8kHz */ - {{0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0},}, /* 11025Hz */ - {{0, 1}, {0, 1}, {0, 1}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0},}, /* 16kHz */ - {{0, 1}, {0, 1}, {0, 1}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0},}, /* 22050Hz */ - {{0, 1}, {0, 1}, {0, 1}, {0, 1}, {0, 1}, {0, 0}, {0, 0}, {0, 0},}, /* 32kHz */ - {{0, 2}, {0, 1}, {0, 1}, {0, 1}, {0, 1}, {0, 1}, {0, 0}, {0, 0},}, /* 44.1kHz */ - {{0, 2}, {0, 2}, {0, 1}, {0, 1}, {0, 1}, {0, 1}, {0, 0}, {0, 0},}, /* 48kHz */ - {{1, 2}, {0, 2}, {0, 2}, {0, 1}, {0, 1}, {0, 1}, {0, 1}, {0, 0},}, /* 64kHz */ - {{1, 2}, {1, 2}, {1, 2}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1},}, /* 88.2kHz */ - {{1, 2}, {1, 2}, {1, 2}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1},}, /* 96kHz */ - {{2, 2}, {2, 2}, {2, 2}, {2, 1}, {2, 1}, {2, 1}, {2, 1}, {2, 1},}, /* 176kHz */ - {{2, 2}, {2, 2}, {2, 2}, {2, 1}, {2, 1}, {2, 1}, {2, 1}, {2, 1},}, /* 192kHz */ +static const u8 process_option[][12][2] = { + /* 8kHz 11.025kHz 16kHz 22.05kHz 32kHz 44.1kHz 48kHz 64kHz 88.2kHz 96kHz 176kHz 192kHz */ + {{0, 1}, {0, 1}, {0, 1}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0},}, /* 5512Hz */ + {{0, 1}, {0, 1}, {0, 1}, {0, 1}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0},}, /* 8kHz */ + {{0, 2}, {0, 1}, {0, 1}, {0, 1}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0},}, /* 11025Hz */ + {{1, 2}, {0, 2}, {0, 1}, {0, 1}, {0, 1}, {0, 1}, {0, 1}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0},}, /* 16kHz */ + {{1, 2}, {1, 2}, {0, 2}, {0, 1}, {0, 1}, {0, 1}, {0, 1}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0},}, /* 22050Hz */ + {{1, 2}, {2, 1}, {2, 1}, {0, 2}, {0, 1}, {0, 1}, {0, 1}, {0, 1}, {0, 1}, {0, 0}, {0, 0}, {0, 0},}, /* 32kHz */ + {{2, 2}, {2, 2}, {2, 1}, {2, 1}, {0, 2}, {0, 1}, {0, 1}, {0, 1}, {0, 1}, {0, 1}, {0, 0}, {0, 0},}, /* 44.1kHz */ + {{2, 2}, {2, 2}, {2, 1}, {2, 1}, {0, 2}, {0, 2}, {0, 1}, {0, 1}, {0, 1}, {0, 1}, {0, 0}, {0, 0},}, /* 48kHz */ + {{2, 2}, {2, 2}, {2, 2}, {2, 1}, {1, 2}, {0, 2}, {0, 2}, {0, 1}, {0, 1}, {0, 1}, {0, 1}, {0, 0},}, /* 64kHz */ + {{2, 2}, {2, 2}, {2, 2}, {2, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1},}, /* 88.2kHz */ + {{2, 2}, {2, 2}, {2, 2}, {2, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1},}, /* 96kHz */ + {{2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 1}, {2, 1}, {2, 1}, {2, 1}, {2, 1},}, /* 176kHz */ + {{2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 1}, {2, 1}, {2, 1}, {2, 1}, {2, 1},}, /* 192kHz */ }; /* Corresponding to process_option */ @@ -55,7 +55,7 @@ static int supported_input_rate[] = { }; static int supported_asrc_rate[] = { - 32000, 44100, 48000, 64000, 88200, 96000, 176400, 192000, + 8000, 11025, 16000, 22050, 32000, 44100, 48000, 64000, 88200, 96000, 176400, 192000, }; /** @@ -287,6 +287,13 @@ static int fsl_asrc_config_pair(struct fsl_asrc_pair *pair) return -EINVAL; } + if ((outrate > 8000 && outrate < 30000) && + (outrate/inrate > 24 || inrate/outrate > 8)) { + pair_err("exceed supported ratio range [1/24, 8] for \ + inrate/outrate: %d/%d\n", inrate, outrate); + return -EINVAL; + } + /* Validate input and output clock sources */ clk_index[IN] = clk_map[IN][config->inclk]; clk_index[OUT] = clk_map[OUT][config->outclk];