From patchwork Mon Dec 18 04:40:20 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akshu Agrawal X-Patchwork-Id: 10118237 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 374746019C for ; Mon, 18 Dec 2017 04:44:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 222D628BA0 for ; Mon, 18 Dec 2017 04:44:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 156E328F0A; Mon, 18 Dec 2017 04:44:56 +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=-1.8 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, RCVD_IN_DNSWL_NONE, T_DKIM_INVALID autolearn=no version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A607A28BA0 for ; Mon, 18 Dec 2017 04:44:54 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 0A2892673CF; Mon, 18 Dec 2017 05:44:52 +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 79FC5267403; Mon, 18 Dec 2017 05:44:50 +0100 (CET) Received: from NAM02-BL2-obe.outbound.protection.outlook.com (mail-bl2nam02on0067.outbound.protection.outlook.com [104.47.38.67]) by alsa0.perex.cz (Postfix) with ESMTP id A317E267196 for ; Mon, 18 Dec 2017 05:44:46 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=xsOyrMRODpzPqoWnKzxJujjYW61KgDn8972R+diw+P0=; b=H1Vyipczj8hMHITcNShT95tLhVhOs/4BCn+rUJ3FWjwvHV9IFusDdQuI5c2xR1nBFkyK/iqM8zwnu7XdmNUyF007nulkPUVqg1IYPs040/+sAygQB38xbA4bXtcAdVNWq2CXaPNTzzSgBmD2RzpH8nzE55RQlJ/tbKNQp7rOB9o= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Akshu.Agrawal@amd.com; Received: from andbang4.amd.com (202.56.249.162) by MWHPR1201MB0189.namprd12.prod.outlook.com (10.174.99.11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.323.15; Mon, 18 Dec 2017 04:44:41 +0000 From: Akshu Agrawal To: alsa-devel@alsa-project.org, broonie@kernel.org Date: Mon, 18 Dec 2017 10:10:20 +0530 Message-Id: <1513572020-7689-1-git-send-email-akshu.agrawal@amd.com> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 X-Originating-IP: [202.56.249.162] X-ClientProxiedBy: PN1PR01CA0106.INDPRD01.PROD.OUTLOOK.COM (10.174.144.22) To MWHPR1201MB0189.namprd12.prod.outlook.com (10.174.99.11) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 215f021a-1582-4227-464e-08d545d20e8c X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(5600026)(4604075)(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(48565401081)(2017052603307); SRVR:MWHPR1201MB0189; X-Microsoft-Exchange-Diagnostics: 1; MWHPR1201MB0189; 3:3/v3vri72dlsoG5pNVx21durcY0uITNbIpraGLarDZMa/I9ffxHhSTGe3uHoS/bcDLkL2plIvJ0Mtc2dPqjicFy5t0Zbf6Q/Yb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x8Ws8mVInqN5C9oyPGNxDJnQP07jQ3uEYuMbvRRZjLJK3uQE2+SiF7fX/r8WURpgQ50XAVWW/cIlsJGXw97A1buivF+MD1+FD4hp2Htc0KotJqCpGWnMSwDD6S2njvFEs+78H0vLlJvhIlSkqml1f77cnx3lFGXL/7gEBCy2OkAErWZjM2p9jMFLKXKSoZhq7YN76lsewKGv9bqaGckXkSA/qA1coNHEqbP4MJr1IlyrRFtTKHmgyA0NCp5wPEsmUm; 4:YisYWybIYNhknOJoD7+AW9oISPR+2V0UjYfG1o/mjsmZkfk+Flv91L0RM2Lj+fGBczq6vdHafGK9G1btNXWuBVyQilFV3V39YUJdZeXhJzBL5rGYdzF89ecNbs9csyZI/vvYOl2Psk5mTFGeNnJ5e5jcliBEHv3h6SpNTlhJ5ShleIW1126K7TbRFeVDnoQx1F2WY7qJ4ynAEKkH4m21+peeNebjxo0YaTjPwBRhhR8MYfd4Sa0isFsm56/Sry6y+X9zCr+prIlxANmP1NMPFL3xeW039hhkYHzoxiOegK0wkPA9/BMJGSPdmA1XeM3Z X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040450)(2401047)(8121501046)(5005006)(93006095)(93001095)(3231023)(10201501046)(3002001)(6055026)(6041248)(20161123562025)(20161123558100)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123555025)(20161123564025)(20161123560025)(6072148)(201708071742011); SRVR:MWHPR1201MB0189; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:MWHPR1201MB0189; X-Forefront-PRVS: 0525BB0ADF X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(366004)(396003)(376002)(346002)(39860400002)(199004)(189003)(39060400002)(6116002)(7736002)(305945005)(4326008)(53936002)(25786009)(3846002)(316002)(16526018)(47776003)(16586007)(86362001)(52116002)(2906002)(53416004)(51416003)(7696005)(386003)(66066001)(478600001)(72206003)(105586002)(6486002)(97736004)(106356001)(5660300001)(6666003)(50466002)(8936002)(36756003)(81156014)(48376002)(50226002)(8676002)(81166006)(68736007); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR1201MB0189; H:andbang4.amd.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; MWHPR1201MB0189; 23:fW7ox3uPKSpRvCcjgpjJfnMFml041bd514GPz5M?= =?us-ascii?Q?r6bFS+8fWgp0qCrlFELoS/nVfLh/f71vRFsfaOlfyGQVRdlczlT91cqAbTJ5?= =?us-ascii?Q?OLomT0x/luKI4khf9RQ8vFLG54erzshp4YHmODXnfYCWH9nxNv5tt4jCWgyT?= =?us-ascii?Q?D/0g2sKll4nLjxrtvIJM4oGgsDvW6bPGPgIp0PQ79WHmB3B2nwfAtWDq9TQM?= =?us-ascii?Q?Nnl39BNluMZWrBN5LcNrSiGOqtzjwglj2ERvuiI0aj1SnMbgWlqJroS4W1GU?= =?us-ascii?Q?6MTIllaVgQS3OQWZPFeKtsKqxdciPVFduw/EUyqVcIHlcMQe+3fc2j50w7v9?= =?us-ascii?Q?GqEDUqXB7t2B2Rm9fX93qwWAy4eoGRl/hRSRFyJ2N1L3bIEKAkmfz8xrvYJz?= =?us-ascii?Q?iX+zj4NnJgv0hVLsG3h7VSNKJ/7uAJC/QlvdggtMsOMb8V5p1UU3OMafZbOq?= =?us-ascii?Q?AdhamtdlE9/SpmliAQ91Vz9uMu6CQERxSmMkhTwbpj7kbnNmOlVa8LvUGO4U?= =?us-ascii?Q?PVHwf+9NjaV32Nhs4xteZy0sVt9s+lxeo4ntKu4+yxRvIeXMAQHse88A/fMi?= =?us-ascii?Q?6VEG49GoZMVZb5KoYts7kZrIdr//K/t000+Rd4hHAg/F2zcndJ8IM9CezxLK?= =?us-ascii?Q?cZErVD5A0pk93RMXtIJolZxFw1mfUDN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fcpkoji+XuloWc27y0Qiz3YEpsDxLHLOsVcUu7+iZxSE/hqvT0xkRYQRnYsODCcyjE9Gp9KlBO+s=; 7:XyEi0c/KDrFQV3uHA+8mPT5YV9qfy5dHUHAdOuwRDQlE0P/N3Wead4ZqrlG4DrbLW1BUgkzWdONXQunHYxW15I6DVITXR4eilO6o2mFCL8nCy19p8QWfHtJJZGzreagsGbGiVuPpWeYC0xfQWyVZM2pG/gI9f/I/CEyLndwsL6LmJDsUhE+7NqFrLFEncSSkfFMxiTPZCh+AYVbT5vWwjYU6l9PDwcp+o3m8EhXwd0/j4MEbt6tf9raLsHnMgsR/ SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; MWHPR1201MB0189; 20:txiB7qUxZWmxl8JEfdImzvbRUIY4m9nVvEXg87y/fHpS7uN5un9QOE1Wa2WOv4vtJ2NRAj5QBQoip9fTKTkQFHPk2i7SD94x1BD8s+TFG8B/tA/YHDkW7QGhKlnHSSkbFW42W2dzCKCC4daDnrsjv9O3s106TtgUjbocNWYaGN1bT1A0tkGDHO/UpRr8lETcvYs9TDmWZs0KXPISCPVwdkBvSivvAyUfM57njCO7o0LM/HWVxwRvh+2zfcWbsg2L X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Dec 2017 04:44:41.2315 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 215f021a-1582-4227-464e-08d545d20e8c X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR1201MB0189 Cc: tiwai@suse.de, Alexander.Deucher@amd.com, lgirdwood@gmail.com, Akshu Agrawal Subject: [alsa-devel] [PATCH] ASoC: amd: Adds rate and channel constraints for capture in Stoney rt5645 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 Constraints are added as we support 48Khz and dual channels. Change-Id: Ib705f1101f5e2ab5c04f9526b10795a45a32debc Signed-off-by: Akshu Agrawal --- sound/soc/amd/acp-rt5645.c | 49 +++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 46 insertions(+), 3 deletions(-) diff --git a/sound/soc/amd/acp-rt5645.c b/sound/soc/amd/acp-rt5645.c index 941aed6..f3f96c6 100644 --- a/sound/soc/amd/acp-rt5645.c +++ b/sound/soc/amd/acp-rt5645.c @@ -40,6 +40,7 @@ #include "../codecs/rt5645.h" #define CZ_PLAT_CLK 24000000 +#define DUAL_CHANNEL 2 static struct snd_soc_jack cz_jack; @@ -91,8 +92,50 @@ static int cz_init(struct snd_soc_pcm_runtime *rtd) return 0; } -static struct snd_soc_ops cz_aif1_ops = { +static const unsigned int channels[] = { + DUAL_CHANNEL, +}; + +static const unsigned int rates[] = { + 48000, +}; + +static const struct snd_pcm_hw_constraint_list constraints_rates = { + .count = ARRAY_SIZE(rates), + .list = rates, + .mask = 0, +}; + +static const struct snd_pcm_hw_constraint_list constraints_channels = { + .count = ARRAY_SIZE(channels), + .list = channels, + .mask = 0, +}; + +static int cz_fe_startup(struct snd_pcm_substream *substream) +{ + struct snd_pcm_runtime *runtime = substream->runtime; + + /* + * On this platform for PCM device we support stereo + */ + + runtime->hw.channels_max = DUAL_CHANNEL; + snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS, + &constraints_channels); + snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, + &constraints_rates); + + return 0; +} + +static struct snd_soc_ops cz_aif1_play_ops = { + .hw_params = cz_aif1_hw_params, +}; + +static struct snd_soc_ops cz_aif1_cap_ops = { .hw_params = cz_aif1_hw_params, + .startup = cz_fe_startup, }; static struct snd_soc_dai_link cz_dai_rt5650[] = { @@ -106,7 +149,7 @@ static int cz_init(struct snd_soc_pcm_runtime *rtd) .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBM_CFM, .init = cz_init, - .ops = &cz_aif1_ops, + .ops = &cz_aif1_play_ops, }, { .name = "amd-rt5645-cap", @@ -117,7 +160,7 @@ static int cz_init(struct snd_soc_pcm_runtime *rtd) .codec_name = "i2c-10EC5650:00", .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBM_CFM, - .ops = &cz_aif1_ops, + .ops = &cz_aif1_cap_ops, }, };