Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp6170063rwd; Mon, 19 Jun 2023 03:30:43 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4cguypq98sWgT9f/msHp/8/X1s6SClRxnSO4x+6UIVaqhBRB2u0fSh9W0p/dAvSWH3j4WM X-Received: by 2002:a05:6808:14c:b0:39e:db80:b7ef with SMTP id h12-20020a056808014c00b0039edb80b7efmr1714227oie.25.1687170643612; Mon, 19 Jun 2023 03:30:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687170643; cv=none; d=google.com; s=arc-20160816; b=rreVAafYA4DmWQhDT5UEfoQGQxr/tc3f4zcULzVE8SsFf8i6yO9dW8xJcjBLiDNh1y idlp70qA/ou2k1QuP4s+TBeFpSxTm25872BWLBBt3Un0bX7+bjQhEhuRGUo7Nnk+bXuz X7BscSQnoytIcCXHumb6eVlEn+Lk6H2W695K7Q/d/wl3YJwVoaTAKEFN3ZKATGlgytGM 76f31LXc1y07gjmbef6i4J+3IbX643v5Id2EA3HZPw16MF72g0jKFLLIAUmWvoLAaoZw jPy28fNTusqarFWlzGLP6elRdviXrwHGbVvLdZNHxBar15VJLDBsEf0jjLG37nh1MmOw dnDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=VzGepGC6ZYnmZGsocL2P2Z4ZNGc2QuSBI4PBc8L8Xeo=; b=QhTYvE0zqI3DdrcvqUZ+1DpEucEqbK15zc4+qWbOrccNPCcslX1MYZr4DpBds7iq5J imx4u3/fMuLK9Das5QZhN039c1qPUAwHNf1nt2qdwDk48WpKIxsw3x4rowtlUheLn37M yxtx1oo2yION4We8WQ9ghIGIn7pcrUmDO7P1P1El6mlPIU0+zfkxlJNQN6oPYgczxuBe /ExRPc6ijJRawfPSEUMTMWmdPKddOGpJmOGwDXINZd3DmrAYUvTTnnXTdTZFLwRq6cIW GALl/9PAg6FuMR48oDrBHcbH7B9cbUyHaw4bL5SiYFcR872LWYTQc9BXffzJxdyf3uFL bMkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TeE5sjg5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id az11-20020a17090b028b00b002477fad79d5si7188492pjb.63.2023.06.19.03.30.31; Mon, 19 Jun 2023 03:30:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TeE5sjg5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231906AbjFSKRC (ORCPT + 99 others); Mon, 19 Jun 2023 06:17:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59390 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231384AbjFSKRA (ORCPT ); Mon, 19 Jun 2023 06:17:00 -0400 Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E867598 for ; Mon, 19 Jun 2023 03:16:58 -0700 (PDT) Received: by mail-wr1-x430.google.com with SMTP id ffacd0b85a97d-30e412a852dso2683406f8f.0 for ; Mon, 19 Jun 2023 03:16:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1687169817; x=1689761817; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=VzGepGC6ZYnmZGsocL2P2Z4ZNGc2QuSBI4PBc8L8Xeo=; b=TeE5sjg5OrE2aYeX3pBftMim05QPJa+/1qvmbEQ7QqIESt06ME2tY/5wUULlHtheGN MlyFiC94sTyk3kzCrpXyrJeEPiecH0uvEUX5s0isGIOCV+u1979I/ihcn3ylReRR1dD2 gF8ikSN6IaM+dloiqmY4eR5e7UBWVsgPUTwehGhqFx91Fzu1A/JL6lt5THWWLibYFg7Y TayBkWuQsVZh8xE0mBIcsxiyfjphS+E7Low2ppJDRJthHifZiq8YMXfi77xCnhElMUgn 7IUJ6UdWQRcRAJeUi/T2GdS30Lz1GvFwvTYSBfQc6i5z/GzoH6v6200DB1dwk2lH8VkE i0pA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687169817; x=1689761817; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=VzGepGC6ZYnmZGsocL2P2Z4ZNGc2QuSBI4PBc8L8Xeo=; b=QMr5K0LZHVPj+SemenL+JYzPw7foqNTxB2W7Mw8WbQ1fvz7CQWbUZeJ/M0+zbaF+ej w6ngyJqZ2z0CYeIC+aSud85JSp2nBqeF1LMXpMQa7OOoLY6Alz7Ivnv8oxhoTN4plu5e Y9zLIRjM0iIteu0sAFbencarAn3dDIJiQ3IIXU4GwaFgci226v8tqcKcRE/q6i1xxPlG G3KZDtVfL8B5wxl0OR9HtuYK9f6xK/Lygh7qaHfBbjpbSknTDoYuxxtXO6BXV49oRgnf M0sicScurdj7gLioF65yjxqV5rFJ8UCiyZBs/RHHtnxBDrinYg8sonk2DlZDHeIz3I82 PSQg== X-Gm-Message-State: AC+VfDyqq8sqgXwDHL42Kd60ixD2kgCPwpPdpfMMTLTbPef/miNoPs1q 2SYlzDd0pFr0QQRfrWJqTSb+eA== X-Received: by 2002:a5d:4952:0:b0:30d:43ca:55ab with SMTP id r18-20020a5d4952000000b0030d43ca55abmr5394016wrs.38.1687169817457; Mon, 19 Jun 2023 03:16:57 -0700 (PDT) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id c2-20020a5d5282000000b002fae7408544sm31146922wrv.108.2023.06.19.03.16.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Jun 2023 03:16:56 -0700 (PDT) From: Srinivas Kandagatla To: broonie@kernel.org Cc: perex@perex.cz, tiwai@suse.com, lgirdwood@gmail.com, ckeepax@opensource.cirrus.com, kuninori.morimoto.gx@renesas.com, linux-kernel@vger.kernel.org, pierre-louis.bossart@linux.intel.com, alsa-devel@alsa-project.org, Mohammad Rafi Shaik , Srinivas Kandagatla Subject: [PATCH v3 01/11] ASoC: qcom: SC7280: audioreach: Add sc7280 hardware param fixup callback Date: Mon, 19 Jun 2023 11:16:43 +0100 Message-Id: <20230619101653.9750-2-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20230619101653.9750-1-srinivas.kandagatla@linaro.org> References: <20230619101653.9750-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Mohammad Rafi Shaik Add support to set backend params such as sampling rate and number of channels using backend params fixup callback. Also add no pcm check for hardware params constraints setting. Signed-off-by: Mohammad Rafi Shaik Signed-off-by: Srinivas Kandagatla --- sound/soc/qcom/sc7280.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/sound/soc/qcom/sc7280.c b/sound/soc/qcom/sc7280.c index da7469a6a267..787dd49e03f6 100644 --- a/sound/soc/qcom/sc7280.c +++ b/sound/soc/qcom/sc7280.c @@ -14,6 +14,7 @@ #include #include #include +#include #include "../codecs/rt5682.h" #include "../codecs/rt5682s.h" @@ -196,8 +197,10 @@ static int sc7280_snd_hw_params(struct snd_pcm_substream *substream, struct sdw_stream_runtime *sruntime; int i; - snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_CHANNELS, 2, 2); - snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_RATE, 48000, 48000); + if (!rtd->dai_link->no_pcm) { + snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_CHANNELS, 2, 2); + snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_RATE, 48000, 48000); + } switch (cpu_dai->id) { case LPASS_CDC_DMA_TX3: @@ -358,6 +361,20 @@ static const struct snd_soc_dapm_widget sc7280_snd_widgets[] = { SND_SOC_DAPM_MIC("Headset Mic", NULL), }; +static int sc7280_snd_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd, + struct snd_pcm_hw_params *params) +{ + struct snd_interval *rate = hw_param_interval(params, SNDRV_PCM_HW_PARAM_RATE); + struct snd_interval *channels = hw_param_interval(params, SNDRV_PCM_HW_PARAM_CHANNELS); + struct snd_mask *fmt = hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT); + + rate->min = rate->max = 48000; + channels->min = channels->max = 2; + snd_mask_set_format(fmt, SNDRV_PCM_FORMAT_S16_LE); + + return 0; +} + static int sc7280_snd_platform_probe(struct platform_device *pdev) { struct snd_soc_card *card; @@ -387,6 +404,8 @@ static int sc7280_snd_platform_probe(struct platform_device *pdev) for_each_card_prelinks(card, i, link) { link->init = sc7280_init; link->ops = &sc7280_ops; + if (link->no_pcm == 1) + link->be_hw_params_fixup = sc7280_snd_be_hw_params_fixup; } return devm_snd_soc_register_card(dev, card); -- 2.21.0