Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1764578pxb; Fri, 5 Feb 2021 00:23:25 -0800 (PST) X-Google-Smtp-Source: ABdhPJw+za7AnogPpixS+mRb0sdvN5FKI6dszGYs4UqYRa+9zU0pnGOvje4yefzLjf48Ig9J1+Ig X-Received: by 2002:a17:906:8555:: with SMTP id h21mr2927048ejy.403.1612513405060; Fri, 05 Feb 2021 00:23:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612513405; cv=none; d=google.com; s=arc-20160816; b=y0UWRq9rERrwBrmfsBZ8QRDqa2RgxWoOFgepQzWtnhxO59B+h8KF5V7+CFe0egsvS+ KC7aA0nQzXpBbFnmWl4NylK6j6bqflxk7NzsZE1v+2hJ1y6TVbYHf8ToTZP3e0DyS9IX NzfMV8ztd74WyNobIEQe8D0HSKS5JUYBD4ci1irrGr7NdCQjyP/CkYVrGPZLHURqpri6 pGz5YSbE5TZJITmnvWdhO6xq/7eDg1aIBeo3QMpJBzYbvZ6bqU6SOJbnwdQBZ8LH46Xk 1Hj42W4bn0N4lWTpgwKJ/Ugj40SW0ByHFMSQv8wexMUELwmAaL3lb3wd2WTSOiBqx+kE blxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from; bh=gABpzPcXgbFHDclsE6BUKg6gE/0kszPfcibWeIrs/GI=; b=r6sKBnecV07V/i2KGS1zaQduLYQSNi0e+A9iZBqj7+U1mq0dGNyKUx4A62vfSytP0w XAiivovSvPGsxSyZfXGDSwqdsDipOb9btnaOgfP/ZdvCEuxFTORGETGJw+S9IL7h1tB3 WdXO9RyKkzF1NeM3w93N3xE/EA4VOpy+6c6GW+yYmVj+XYivl8Ql86P0nG8pq8XM7GqQ MRm8smUmvU6P05qo2sjsqMa9ZNZqzeKlN60Hz3jgNrZbMlOVz33A2JGcOuxhgCnnfI0H aqJxfVhpn5MoFt/QVl/2qLhtR3WKIl5NLydBK5tP5d9SeeHikCyHDw+2hf/c3sRcuP0u Yh4A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l18si4726370edw.180.2021.02.05.00.23.00; Fri, 05 Feb 2021 00:23:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231713AbhBEITW (ORCPT + 99 others); Fri, 5 Feb 2021 03:19:22 -0500 Received: from mailgw02.mediatek.com ([1.203.163.81]:49040 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S231704AbhBEISh (ORCPT ); Fri, 5 Feb 2021 03:18:37 -0500 X-UUID: 03e149f156a747148be635d5d2b45a5c-20210205 X-UUID: 03e149f156a747148be635d5d2b45a5c-20210205 Received: from mtkcas36.mediatek.inc [(172.27.4.253)] by mailgw02.mediatek.com (envelope-from ) (mailgw01.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 1860454707; Fri, 05 Feb 2021 16:17:49 +0800 Received: from mtkcas07.mediatek.inc (172.21.101.84) by MTKMBS31N2.mediatek.inc (172.27.4.87) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 5 Feb 2021 16:16:55 +0800 Received: from localhost.localdomain (10.17.3.153) by mtkcas07.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Fri, 5 Feb 2021 16:16:55 +0800 From: Jiaxin Yu To: CC: , , , , , , , , Jiaxin Yu Subject: [PATCH] ASoC: mediatek: mt8183-mt6358: set playback and capture constraints Date: Fri, 5 Feb 2021 16:16:52 +0800 Message-ID: <1612513012-27688-1-git-send-email-jiaxin.yu@mediatek.com> X-Mailer: git-send-email 1.8.1.1.dirty MIME-Version: 1.0 Content-Type: text/plain X-TM-SNTS-SMTP: ABDA0BD1C6EEB5A07F7B91F8D61EE9147B36F064D4DF7B33ACAC22C941DBE8892000:8 X-MTK: N Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Sets playback and capture constraints to S16_LE, stereo, 48kHz. Signed-off-by: Jiaxin Yu --- .../mt8183/mt8183-mt6358-ts3a227-max98357.c | 41 ++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/sound/soc/mediatek/mt8183/mt8183-mt6358-ts3a227-max98357.c b/sound/soc/mediatek/mt8183/mt8183-mt6358-ts3a227-max98357.c index 3cf8aea..271413e 100644 --- a/sound/soc/mediatek/mt8183/mt8183-mt6358-ts3a227-max98357.c +++ b/sound/soc/mediatek/mt8183/mt8183-mt6358-ts3a227-max98357.c @@ -118,6 +118,45 @@ static int mt8183_rt1015_i2s_hw_params_fixup(struct snd_soc_pcm_runtime *rtd, } static int +mt8183_mt6358_startup(struct snd_pcm_substream *substream) +{ + 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 unsigned int channels[] = { + 2, + }; + static const struct snd_pcm_hw_constraint_list constraints_channels = { + .count = ARRAY_SIZE(channels), + .list = channels, + .mask = 0, + }; + + struct snd_pcm_runtime *runtime = substream->runtime; + + snd_pcm_hw_constraint_list(runtime, 0, + SNDRV_PCM_HW_PARAM_RATE, &constraints_rates); + runtime->hw.channels_max = 2; + snd_pcm_hw_constraint_list(runtime, 0, + SNDRV_PCM_HW_PARAM_CHANNELS, + &constraints_channels); + + runtime->hw.formats = SNDRV_PCM_FMTBIT_S16_LE; + snd_pcm_hw_constraint_msbits(runtime, 0, 16, 16); + + return 0; +} + +static const struct snd_soc_ops mt8183_mt6358_ops = { + .startup = mt8183_mt6358_startup, +}; + +static int mt8183_mt6358_ts3a227_max98357_bt_sco_startup( struct snd_pcm_substream *substream) { @@ -356,6 +395,7 @@ static void mt8183_mt6358_tdm_shutdown(struct snd_pcm_substream *substream) SND_SOC_DPCM_TRIGGER_PRE}, .dynamic = 1, .dpcm_playback = 1, + .ops = &mt8183_mt6358_ops, SND_SOC_DAILINK_REG(playback1), }, { @@ -403,6 +443,7 @@ static void mt8183_mt6358_tdm_shutdown(struct snd_pcm_substream *substream) SND_SOC_DPCM_TRIGGER_PRE}, .dynamic = 1, .dpcm_capture = 1, + .ops = &mt8183_mt6358_ops, SND_SOC_DAILINK_REG(capture3), }, { -- 1.8.1.1.dirty