From patchwork Fri Dec 18 09:00:09 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zidan Wang X-Patchwork-Id: 7880851 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 0C653BEEED for ; Fri, 18 Dec 2015 08:58:16 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0948D204A9 for ; Fri, 18 Dec 2015 08:58:15 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 7515F204AD for ; Fri, 18 Dec 2015 08:58:13 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 78A9E26590E; Fri, 18 Dec 2015 09:58:12 +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 200E0265191; Fri, 18 Dec 2015 09:58:10 +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 4E72526525F; Fri, 18 Dec 2015 09:58:09 +0100 (CET) Received: from na01-bn1-obe.outbound.protection.outlook.com (mail-bn1bn0109.outbound.protection.outlook.com [157.56.110.109]) by alsa0.perex.cz (Postfix) with ESMTP id A6D412650D1 for ; Fri, 18 Dec 2015 09:58:01 +0100 (CET) Received: from BLUPR03CA011.namprd03.prod.outlook.com (10.255.124.28) by CY1PR0301MB1260.namprd03.prod.outlook.com (10.161.213.12) with Microsoft SMTP Server (TLS) id 15.1.361.13; Fri, 18 Dec 2015 08:57:59 +0000 Received: from BN1BFFO11FD054.protection.gbl (10.255.124.4) by BLUPR03CA011.outlook.office365.com (10.255.124.28) with Microsoft SMTP Server (TLS) id 15.1.361.13 via Frontend Transport; Fri, 18 Dec 2015 08:57:58 +0000 Authentication-Results: spf=permerror (sender IP is 192.88.168.50) 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 tx30smr01.am.freescale.net (192.88.168.50) by BN1BFFO11FD054.mail.protection.outlook.com (10.58.145.9) with Microsoft SMTP Server (TLS) id 15.1.355.15 via Frontend Transport; Fri, 18 Dec 2015 08:57:55 +0000 Received: from b50113.ap.freescale.net (b50113.ap.freescale.net [10.192.241.29]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id tBI8vpc0032652; Fri, 18 Dec 2015 01:57:52 -0700 From: Zidan Wang To: Date: Fri, 18 Dec 2015 17:00:09 +0800 Message-ID: <7ff4f7a6d8b3927664f6350232f46c81d6c6be80.1450429119.git.zidan.wang@freescale.com> X-Mailer: git-send-email 1.9.1 X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1; BN1BFFO11FD054; 1:FJgPSPa2x/aUOxosUXMcIWC7NGRx7YS/Ni4/SHwDJR3qBa1aEp1V5yXgTw6lZACWId5iXhV0+ryXDWpcyXU7D0P/+6IhbiKn9qtDTaaSNABmO4rtQvm21ua8Gv/sC69enKEHUj70SJdCZ8GI02xBFJ0Ae+LSN/ozjQj4k5tjmn8jbJUB/5HyHWxdWYuZJfxvZjDQ31YQ2MHi7CcvbIZnF/3CBGAR5bqzIfyadwan9KxQHDl/cKWFQIytZdLqh30HzPIczpfmysD+gf19NXF2sB+rPnLvkQ933CasY3LlpDONKbIG8DTCuvI70HXVnbYcMYoPckaGRehOHOyk7N2DTubVh0FUKMb5KHWp/51mSOydbGD7r9HPGbhXK+Wq7+7VMull5iFKCabU+QqLUiSiyiw9Pon018OdLHNZY5d0spMyuaae2oNMUnu2z5xXpgo5 X-Forefront-Antispam-Report: CIP:192.88.168.50; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10019020)(6009001)(2980300002)(448002)(3190300001)(189002)(199003)(5003940100001)(85326001)(50466002)(110136002)(118296001)(5001960100002)(106466001)(189998001)(107886002)(87936001)(33646002)(50986999)(97736004)(86362001)(81156007)(586003)(48376002)(36756003)(19580405001)(229853001)(47776003)(1220700001)(2351001)(5008740100001)(104016004)(6806005)(4001430100002)(77096005)(19580395003)(92566002)(1096002)(50226001); DIR:OUT; SFP:1102; SCL:1; SRVR:CY1PR0301MB1260; H:tx30smr01.am.freescale.net; FPR:; SPF:PermError; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; MIME-Version: 1.0 X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB1260; 2:UMT18sgiYUs+WvNk1jPw97AnJNsc0pOcGw474fkh+nm8pTmWAG/Er0Olh/U7TD5U527hTanLs6L8VMBNM3zsMIZGonxHjJ0kA5d1zMEzlgkLGEwcBqz8xLdUVgCR6cKG0mP7e6k9H8FikuSossbTyQ==; 3:gRW0BjEB/GZlZrwA6nkCkkFyXs9H8+0vSGGTFXbWFO1NMNxyMCVURTYIjxBwL/xhmPf7rMWaZs6sNtluJHdE61aL6VGNAVSyiI3RCsxbds6gXNLWBmNeFWFQDzUqs8IsXbko157HZ/aDF49H7GavTcDTMRh5Zy/221XxiYkVDnZo2sO4R1IQ5xiTeyi1fluzGAQejK6HI0GelkuyjP3RF+ot9jGRkLmqjWiIlMQPvDo=; 25:TdWzNn4EKBYLogphlaViyiyalDzAn/nUonAhPnNlCjRaLu3L0WlrUGXqODPyWkGksSANQxlUbIWiLvQiwdHWx0q1c1gJgKpBg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RVS: 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:CY1PR0301MB1260; BCL:0; PCL:0; RULEID:; SRVR:CY1PR0301MB1260; X-Forefront-PRVS: 07943272E1 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1PR0301MB1260; 23:kxKtClF9gQVIW+dCjEPhskPjnroMmkRvW09JLyh?= =?us-ascii?Q?02lW9NauoL3+NmZsMn7NK+eQAnbCLrHeqAZfyGs/zFmJMyt9nD+/nmjbh/Vi?= =?us-ascii?Q?2KVXhGih0Tl+TZGomHW91G6gpeg757GtebZ1v1HqvQnQ/g1+tqP5uGeDf1Qr?= =?us-ascii?Q?FoFyMMqByTMzvoiP/FFI0LmG1KSHGy9tYpDs3IqxsuALYta7U3JHDuUXcWPs?= =?us-ascii?Q?mhe9R9QBV65knxbQdFxuMLpeTVG+2odKb3dh15/G447bmHq7lysRB750lL5h?= =?us-ascii?Q?YMVSUo3yksjO5EWmZkCEK4Z7TlHkGar8sRQmo55F76WRhfwQbZgr9AG0sJgD?= =?us-ascii?Q?1UvRoICdz4w2Bj+zawpCFuy79bkEgh+7DD8mTmzoSC9lOD7lQlLChxrTENwf?= =?us-ascii?Q?I+6disZBuhT0f+odCIdXL+H78Rf1ZlQlsCckHIhOMeBOlbGfLA9KMDVoXPlH?= =?us-ascii?Q?SavVbcT2QVXDId/PcSkWOlmKCVocR086vLz2oTmXydtNOBVXnV4VhX4Ii7EB?= =?us-ascii?Q?Axw3nPFuLQyU7SBtguPLVlBf+auW0z/ZAzHEM/6SVRFzekeE6LMdfSe9w9kQ?= =?us-ascii?Q?QyRJWkUaSmiN6oKmMzaS2ZgOBsk12LziHnGblFWiLb8SO4gPDYFa2udS/8eD?= =?us-ascii?Q?emo4f5qzK7XP2ROG8G2K0cu840wZwSb6tI8AOV7cn3z/iwa5nyyvr9a2Oo2t?= =?us-ascii?Q?H3NmdLSsMNKNi/wZ3gzLMPxJrXfsktAJcLf8F9zzMaI9/vUsHM/xQWJotrVu?= =?us-ascii?Q?NClTUmEW8oNqMiy2JQ7yqsQznI/srrCzrdiNSI2TjLmNHIP8Xf9U7igfjh6L?= =?us-ascii?Q?5xIcrWqxJrsvw8BX6+WoxIToScttcdZgsYqREqCnyV9Z2QEdehzMMcj0CNYa?= =?us-ascii?Q?Uu+Wq1Rm9Zb8szK3d/Z5CDDv7j74vcqgn99up6ZcrxAeeJm7KJKl2OkfhoAM?= =?us-ascii?Q?Pg8q4beogpO+VMM7kfgIHAu7/y/o4V2UQlW+Lx4rn7NAo3VfRFWpc5IGioK8?= =?us-ascii?Q?nLbPf9dcdKn/BPOWaBXpKSbOm?= X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB1260; 5:uCIgSRPQ2MXLs+jWqidyr0JwNFAtUZ8apX3Bb04tFt9chFjSP+2scq2qddZoYPo9A3IlNaz5nWaPDvDxS4gwbY9UEbv4S4hwfoJOax5HcVbODxPE3mG31Gi77WKnMuKKM9q1QKAWTTLhkpl7TfsbFA==; 24:p2r5j2F1bmOVo4ScRkyLlbhq7/t4bNsO+FXzDpVmD0I/6g2MWgmXnDTOiyXGV0GCv3rqrl0WgwrA9hkiCx1KyWewOgRQn51FYibyYM6ZZ3Y= X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Dec 2015 08:57:55.5890 (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.168.50]; Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR0301MB1260 Cc: alsa-devel@alsa-project.org, Zidan Wang , Xiubo.Lee@gmail.com, tiwai@suse.com, nicoleotsuka@gmail.com Subject: [alsa-devel] [PATCH v2] 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 Acked-by: Nicolin Chen --- v1->v2: 1. fix indentation issue. 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 d964016..bd32c30 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];