From patchwork Sat Mar 2 05:52:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shengjiu Wang X-Patchwork-Id: 10836477 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EC29014DE for ; Sat, 2 Mar 2019 05:53:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CB1152A29D for ; Sat, 2 Mar 2019 05:53:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BB7832CAB4; Sat, 2 Mar 2019 05:53:21 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0F2F12A29D for ; Sat, 2 Mar 2019 05:53:21 +0000 (UTC) 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 02246851; Sat, 2 Mar 2019 06:52:29 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 02246851 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1551505999; bh=RK/hEFomwLoUmlmPfBf91MY+ToPX83Yx4jNeBMFRPKM=; h=From:To:Date:Cc:Subject:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From; b=bnRtOF2y+2iqVsRr6Agn2WeGlWkzFijdnyKcwpwv63poWo5yrL4ybYn18LSAObCGP 1gHEVJXyyRVAlJzxTw/bSvkNKNFQUq3MadYESedMuM1cOWtbEH4ypziZjjGjOmc6Xn GGHbLfyBFEZik/GqdkMC3l075KLqe1N5/JnPL7yc= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 5BD76F896D6; Sat, 2 Mar 2019 06:52:28 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa1.perex.cz (Postfix, from userid 50401) id D4816F896DB; Sat, 2 Mar 2019 06:52:25 +0100 (CET) Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-eopbgr150040.outbound.protection.outlook.com [40.107.15.40]) (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 289AFF896D6 for ; Sat, 2 Mar 2019 06:52:21 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 289AFF896D6 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="Q+IP3hwA" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=r/YjXl4/l3aKbrP4KsNjvu5Xaul9Fa/j1nASwFieHJM=; b=Q+IP3hwAi2j/F09OEkfvGtWI/RKkDT8QdW7WE/SZ3NxI59ZftUrS+HtzCTQutznEgRyOtNu3Wx8PzcJFwc+fxUYPtuDpqmuNY9TfueaMCAnebDK+ZBiDAP+C9bVwWUCqiH1XMgejNC6eBYjGd9r6rP9kaL0zscsyi0BmQSWqSKU= Received: from VI1PR0402MB3392.eurprd04.prod.outlook.com (52.134.1.153) by VI1PR0402MB2814.eurprd04.prod.outlook.com (10.172.255.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1665.16; Sat, 2 Mar 2019 05:52:19 +0000 Received: from VI1PR0402MB3392.eurprd04.prod.outlook.com ([fe80::407:6e30:6a9d:2a22]) by VI1PR0402MB3392.eurprd04.prod.outlook.com ([fe80::407:6e30:6a9d:2a22%3]) with mapi id 15.20.1643.022; Sat, 2 Mar 2019 05:52:19 +0000 From: "S.j. Wang" To: "timur@kernel.org" , "nicoleotsuka@gmail.com" , "Xiubo.Lee@gmail.com" , "festevam@gmail.com" , "broonie@kernel.org" , "alsa-devel@alsa-project.org" Thread-Topic: [PATCH V3] ASoC: fsl_asrc: add constraint for the asrc of older version Thread-Index: AQHU0LwYZBzCy+o+tE2/+t7z5LKboQ== Date: Sat, 2 Mar 2019 05:52:19 +0000 Message-ID: <3fc3a2cbe15b67537be9e97beff0d97f619a063f.1551505839.git.shengjiu.wang@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 1.9.1 x-clientproxiedby: HK0PR01CA0009.apcprd01.prod.exchangelabs.com (2603:1096:203:92::21) To VI1PR0402MB3392.eurprd04.prod.outlook.com (2603:10a6:803:3::25) authentication-results: spf=none (sender IP is ) smtp.mailfrom=shengjiu.wang@nxp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [119.31.174.66] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 710e3c29-b4ff-46f9-13cc-08d69ed33b11 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600127)(711020)(4605104)(4618075)(2017052603328)(7153060)(7193020); SRVR:VI1PR0402MB2814; x-ms-traffictypediagnostic: VI1PR0402MB2814: x-microsoft-exchange-diagnostics: =?iso-8859-1?Q?1; VI1PR0402MB2814; 23:wPB4iYeuqqdbcLLmv9BRZXol362kYSeCws6xq?= =?iso-8859-1?q?28HN1PX4hE++3pMpv?= =?iso-8859-1?q?9EpEDzewPjpEx1lNrazxTyPrB+8n6H8c1Zabm8MNjh6t2WFpP35TIXvF9fq1?= =?iso-8859-1?q?77/g9beY66Y3g7KkBmr4NRlRZHswgz/0dN6Xn3Do9UctJ90CJ8J3a/w312GR?= =?iso-8859-1?q?YUMGwlnO1AYg0ucrjiaDASv9VwnkmsTsuQokcnrWOg0xfoYXs+9vPWxNhCtS?= =?iso-8859-1?q?QQVWjnfqWn5Vc6TLjL5Vu6NqYhIEGYvj5cYaHEqE3qtDMUimG+zgrbbPTmMs?= =?iso-8859-1?q?1JTROduK0UK2ZrcXetCzu7tRXlI1prlgYWygXe9UIIMfup3Qi+VpIdVTQfz3?= =?iso-8859-1?q?6ToUbsDgXECRePahSzRXAui1JWEDtUEDSDh+ICzqi4FSIm2ks96LNtJla2qs?= =?iso-8859-1?q?cbiloLTzfnEQXLEzFwj4mmoklJSd+D2aUgGePAKQBFRZl8WWJKF5AqG8zjE4?= =?iso-8859-1?q?Bvb3fWS9ouAVffjlm4/0QFNCXHderHdVQea3O5o5Q3s7r9BdYhzLWamFYXaq?= =?iso-8859-1?q?BqoPBiB4UG+9vrOqsp3SPFgBpfZ7Yq7Hws+cUy3Lbxao6PBeP8C6N/UTdkay?= =?iso-8859-1?q?ZOs1N5E3Wdv+9wmyN+Pz/cD2SGkn5Moq3kLxcTbUXq8mgpmhpA0npch3o9e0?= =?iso-8859-1?q?se01+lQ17ReOxCHgyUtVe7dNIk5ZQAKMrPPaICGNg1V7Ptug2X9Of4B9o+SL?= =?iso-8859-1?q?LyM8MVKVUVqEdleP/dQcPfMFMIBKumLBh5EllCoGgKnlgyRs68ZrYTCVYjeP?= =?iso-8859-1?q?kCEWeIBVVAiQk5vKA37gWF8X1UNEykce0o8KtQ0cBmlAH5faGOpajGYN2JgO?= =?iso-8859-1?q?+fkq9oe+3S659eh9NrArFjl4MlgIxUC6m42/Fqvap3eZP7yrPR3bOhYUKedQ?= =?iso-8859-1?q?eAHaLFxzmyhk4W8KKJM5y3hJrrl2s+omfc3NUFHchS/uG1LlK2UReVTg/4SV?= =?iso-8859-1?q?A5oRUqdk+/9xFNuGbN+nvh0ElTx3LaoNXVrUdIMWqR1zOoVBo79Ac3B2bfe9?= =?iso-8859-1?q?B5aEys9G0fJXWBw7Ov+FPhEE9t437UsLSZlM/DFBVgydXXXXLsT/SBTj5HDq?= =?iso-8859-1?q?eDNutyUulsAp138JTE9kfGk+TDBgsjgxzf3d13mmT3WDJP5I9WVpjNgGZM/H?= =?iso-8859-1?q?0Y1re0RDjtRcobTwDUxjycgVIed+ztdC+RImC1DQ=3D=3D?= x-microsoft-antispam-prvs: x-forefront-prvs: 09645BAC66 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(366004)(376002)(136003)(346002)(39860400002)(396003)(199004)(189003)(2501003)(71200400001)(4326008)(256004)(71190400001)(99286004)(2906002)(66066001)(5660300002)(52116002)(110136005)(2201001)(6116002)(86362001)(3846002)(97736004)(316002)(25786009)(478600001)(14454004)(50226002)(105586002)(81166006)(81156014)(8676002)(2616005)(6436002)(106356001)(476003)(26005)(6512007)(486006)(36756003)(186003)(53936002)(7736002)(102836004)(8936002)(386003)(6506007)(305945005)(68736007)(118296001)(6486002); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR0402MB2814; H:VI1PR0402MB3392.eurprd04.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: XEC28yifdOb/rHQGiBUKM59StxL5/EBs4B+XGULpr7b5RjlAXYLX9HRjP8DKfg2VifalXe4gA0lymqb7eKJJlHV3n7SZyBO91a5EWxWr7977NdnooaAvNJzAZotQz8T1hAokZIw4CY7qwTk/d6xR2QHRWbdZPbyVoILFE803bc5lCg/cKmFF4tSruklf2gV1lCGjfsexeccsvMXstRmv82f+4VAuIVxRQJUFI34zq/DAfvv/Oe4BRYhWwIeYjT1rZJx8d9u3/XAC4Y2n/guruJ8ZyTiplJAL4exITFfr77PwFaK/UrsQyCps91snCYhMnHFcT8nYADJClEDyiMHRoxXiRkKqAw+ttpIXdwdclWodzd8YG05KYO2wn2cvGOsZHWsyh5+BKljRp6B5MhL3HCuOaPjwWx/J1K02wYXP/R4= MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 710e3c29-b4ff-46f9-13cc-08d69ed33b11 X-MS-Exchange-CrossTenant-originalarrivaltime: 02 Mar 2019 05:52:16.1449 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0402MB2814 Cc: "linuxppc-dev@lists.ozlabs.org" Subject: [alsa-devel] [PATCH V3] ASoC: fsl_asrc: add constraint for the asrc of older version 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" X-Virus-Scanned: ClamAV using ClamSMTP There is a constraint for the channel number setting on the asrc of older version (e.g. imx35), the channel number should be even, odd number isn't valid. So add this constraint when the asrc of older version is used. Acked-by: Nicolin Chen Signed-off-by: Shengjiu Wang --- Changes in v3 - fix comments with Nicolin's review sound/soc/fsl/fsl_asrc.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/sound/soc/fsl/fsl_asrc.c b/sound/soc/fsl/fsl_asrc.c index 528e8b108422..0b937924d2e4 100644 --- a/sound/soc/fsl/fsl_asrc.c +++ b/sound/soc/fsl/fsl_asrc.c @@ -445,6 +445,19 @@ struct dma_chan *fsl_asrc_get_dma_channel(struct fsl_asrc_pair *pair, bool dir) } EXPORT_SYMBOL_GPL(fsl_asrc_get_dma_channel); +static int fsl_asrc_dai_startup(struct snd_pcm_substream *substream, + struct snd_soc_dai *dai) +{ + struct fsl_asrc *asrc_priv = snd_soc_dai_get_drvdata(dai); + + /* Odd channel number is not valid for older ASRC (channel_bits==3) */ + if (asrc_priv->channel_bits == 3) + snd_pcm_hw_constraint_step(substream->runtime, 0, + SNDRV_PCM_HW_PARAM_CHANNELS, 2); + + return 0; +} + static int fsl_asrc_dai_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params, struct snd_soc_dai *dai) @@ -539,6 +552,7 @@ static int fsl_asrc_dai_trigger(struct snd_pcm_substream *substream, int cmd, } static const struct snd_soc_dai_ops fsl_asrc_dai_ops = { + .startup = fsl_asrc_dai_startup, .hw_params = fsl_asrc_dai_hw_params, .hw_free = fsl_asrc_dai_hw_free, .trigger = fsl_asrc_dai_trigger,