From patchwork Fri Mar 1 08:37:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shengjiu Wang X-Patchwork-Id: 10834677 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 D99991575 for ; Fri, 1 Mar 2019 08:38:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C49452F718 for ; Fri, 1 Mar 2019 08:38:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B7C912F747; Fri, 1 Mar 2019 08:38:10 +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 802F62F718 for ; Fri, 1 Mar 2019 08:38:09 +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 ED37B857; Fri, 1 Mar 2019 09:37:16 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz ED37B857 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1551429487; bh=CL+XVCA03boBhwozRCyahjZFUNN3vEYsFgf2ln9noeM=; h=From:To:Date:Cc:Subject:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From; b=MwI7HNNoPHxwlmkxBxk8G9RL3Vt0wE90tPzYY93KGgltvC/kia+zbIxV491+udfQh NtyF7C33uWe3Q2FL0c1qrb7ZRfFzMIsSKt4qxPxnAQz7pKoJGd/qP1cHERScVQbmyP paKGKberckQ7lPKNYRU6S4tFTul5zGU9J+dv/E4I= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 48E07F896C0; Fri, 1 Mar 2019 09:37:16 +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 DBBB5F896DF; Fri, 1 Mar 2019 09:37:14 +0100 (CET) Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-eopbgr150082.outbound.protection.outlook.com [40.107.15.82]) (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 78E96F8073C for ; Fri, 1 Mar 2019 09:37:11 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 78E96F8073C Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="oerUJO/Q" 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=ttRDiH7lCn113OfRg+xZYlT7cWOOfAT79L5q/UP7RzM=; b=oerUJO/QmwzXL7NugLO+JzwCM9zAB+9cZ+7oMt53HsRr6ksC1SOIUg28AXst986l1TCQcl/bOob9P4OqISaLNtecinF7Wt7RAKOov86VPyo3TP7IY+G1RR922bWXVIqlZONern6gFqj6w+KxhWGUThhBdg5EmY3mesACqZHG1N0= Received: from VI1PR0402MB3392.eurprd04.prod.outlook.com (52.134.1.153) by VI1PR0402MB2783.eurprd04.prod.outlook.com (10.172.255.13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1643.16; Fri, 1 Mar 2019 08:37:09 +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; Fri, 1 Mar 2019 08:37:09 +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 V2] ASoC: fsl_asrc: add constraint for the asrc of older version Thread-Index: AQHU0An1hGn59KuT1UaLuZVdqt/UKw== Date: Fri, 1 Mar 2019 08:37:08 +0000 Message-ID: <24ebf5b610cc69f18c05e4aefa1874ae23861943.1551429264.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: HK2PR06CA0016.apcprd06.prod.outlook.com (2603:1096:202:2e::28) 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: 5b3bcda1-1ed8-4354-b44c-08d69e211784 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:VI1PR0402MB2783; x-ms-traffictypediagnostic: VI1PR0402MB2783: x-microsoft-exchange-diagnostics: =?iso-8859-1?Q?1; VI1PR0402MB2783; 23:UnDq+hllvK2YYgRRjAt1cdUoMBWN7hDXSdYa/?= =?iso-8859-1?q?lTc5rUY7N1JOHXVIL?= =?iso-8859-1?q?F93c08H7MTxcl+NlocEH8zffXRsi0LMjs3qgk33Mxh1MVqWIDRB2gjxloqf2?= =?iso-8859-1?q?j+LdeHpuTV8tgEIvjMTiMbTkbE0PXZVUaPUWejrNymfagqGUgqtVeM9+4i+8?= =?iso-8859-1?q?ynxQ/LwqMBSBXyze7Z+PwiLBzfrF8p806JN0un2N2zlp4IAdhnZ2NXbKumxi?= =?iso-8859-1?q?kghjwSVrw30EdTyraRd/p84hHKqImfQYCIY9ngcsiyQpqmCX0TziXKy1yQeA?= =?iso-8859-1?q?qlcZVfb01iDnE08Qh+XDTG/3Rf+bNo3DBOvHPWlhkAOk85oKVZrjjPlyi/Er?= =?iso-8859-1?q?3lgp6PPqFN+ouHWMLNPcktJsBH9vsi1E2PVJNb7SKhG4bhsTkwDiG5JCp6TY?= =?iso-8859-1?q?qxzIieT9lKuWHfhAy+yJpHQqxUqJkV70ZidgdcMvw5MmaB5mKjD7zPKxIWAJ?= =?iso-8859-1?q?AoyR1TY1UQUEjQx2axmXOGB2bQNseRr7ORcH3lA1Zk+0tE0zh53j16RdXzzE?= =?iso-8859-1?q?c0R/mSskw4pJfb3PaYRKZIEjS8FqlQ+I3B+J3YJwW4eoPdH/ErEvIwHSOkFy?= =?iso-8859-1?q?bAHUp3mLU2MgrONMEswNdSyHjzAiIPjEr5TWkEkY6A+1UjEoPdLemJLSc6vi?= =?iso-8859-1?q?ZyFNtmr7JzqKrHUXHSdIG0XCkALr5SgQh9FaIkIppM1X9/QAM2NP1mj+/tIe?= =?iso-8859-1?q?y5vRDLfUbiP/ccJrZvBJozEGvXbqHd4j4ozA29RFmH5ndEWukd+bqY/TFHZe?= =?iso-8859-1?q?P3cp6g2EVgOCItvGOJp6U3AmO+KZ3fwINDDVjiknfIAmakCPfJ9XVe15NrxC?= =?iso-8859-1?q?IlSUWgLoO0RKj6Qu1Q5OTZb/4WFxIxhciLoNCfxNXOHxz2UxN8tugC80dGZT?= =?iso-8859-1?q?HGeUt5xKlsyFFA0/ndA/ufYyuSFRMPVbOMn5bCzAJ+FhCqVnM7IvYtFE2iBm?= =?iso-8859-1?q?mCEPngrSahhFeTdT4a6BJYKso4GhRUt/DFWhQXkoohCS4LrS+igrNnSTMJG4?= =?iso-8859-1?q?g1ecCapkVT6TLXh8rw0fnWCASuyjL5gQCkgGaLad4FqFfdls0/UO/aFf7SxC?= =?iso-8859-1?q?4kX/OYhicnjAGKQDb/22+UcJaHaFOCFNSY548XPSUDTqhazgci5Ex76hVS4r?= =?iso-8859-1?q?u07xC9hY3ZKycAvyV2Td/3mYba/EBcF4Zp+sEAyQ=3D=3D?= x-microsoft-antispam-prvs: x-forefront-prvs: 09634B1196 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(366004)(376002)(136003)(346002)(396003)(39860400002)(199004)(189003)(486006)(2201001)(71190400001)(2616005)(110136005)(186003)(14454004)(316002)(99286004)(71200400001)(26005)(118296001)(2501003)(66066001)(476003)(256004)(2906002)(6116002)(3846002)(36756003)(8676002)(6512007)(8936002)(53936002)(97736004)(4326008)(81166006)(6436002)(6486002)(6506007)(478600001)(52116002)(25786009)(106356001)(305945005)(68736007)(105586002)(386003)(5660300002)(7736002)(102836004)(86362001)(81156014)(50226002); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR0402MB2783; 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: rxyeZryGs15imrvRAcZQo5JvYRsgOa9Sb2/bs6Ri3glbouTuWzVWtEwlZUzYItToi0AyxSzYrMYBBnYJgDsZB0cNJsFoWegO3agh+K7B+K1IJw4OPZ3zyUuGx/7S6me6yXtK1aZAsdn690B3NFaqm4fw9RxXJqwiXORZX4DLVw+Jjg1szIS8EUuNdzTIAKuNs6lt0t5oPt3q9SdrLI8oTkms1/VDnH+P90vJkiTVOEHzvRF+28spT0beNrbYX8uEuVfUexNPCsh9KyZD0AIh5qZJe/i56zHU1bSJ5wlvGbA3eLBR5K+WIP8pP8IXc0915PR2SMSkmN7W71ead4z2OyxGTqxVLC6GZceXgH6ri++UpIQx5m+O+ZNbBslHtrv2L66apkNaqz7pImJngsFCctRP5d4n59lhEMwVCEQymUQ= MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5b3bcda1-1ed8-4354-b44c-08d69e211784 X-MS-Exchange-CrossTenant-originalarrivaltime: 01 Mar 2019 08:37:06.0998 (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: VI1PR0402MB2783 Cc: "linuxppc-dev@lists.ozlabs.org" Subject: [alsa-devel] [PATCH V2] 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 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. Signed-off-by: Shengjiu Wang Acked-by: Nicolin Chen --- changes in v2 - switch to add constraint in startup function 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..31494f225037 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); + + /* channel_bits = 3 means older version on imx35*/ + 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,