Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2212935rwd; Fri, 9 Jun 2023 08:08:11 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4O6E9lfFX2C9eXiQYPPK3S9TVhtBsp//P3ibb6UpNh8jCYYiWSfop6RZ3LfWlNga2NtDCO X-Received: by 2002:a05:6a00:21d4:b0:643:53b6:d841 with SMTP id t20-20020a056a0021d400b0064353b6d841mr1614931pfj.2.1686323290576; Fri, 09 Jun 2023 08:08:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686323290; cv=none; d=google.com; s=arc-20160816; b=gKfF4yWtsf5Tgj5tQzgKYnu57GpOWH7KKGwRfJ3mvy01rS8FF2Dn1nyy1nOD868sJy MW5autY4dxoPJOq6AQ4qxdYl04QgcEX3dYVcew3A3qmZ+Dfy5gOGM6qLeTYCw03HrE4Y 6UcSKCbMYvZ6dxO/7WlUtjttJVDKsvgD9/SXPxfmiuaGzPb69az/XD0Mr4zVafb6AL0D OvIqLaCXhd6MgsCgOseJSDN7na1itulsIFo/3LXClTWc7oFb2t4AxXKBpMaqDEjbw76f WQwCVmtfS7rQ4jk884vwGBnlRRAXDVpTQjzfrrreLpRMbe0Dnao/5X6Axzl1DnGjmQuR 5cEA== 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=1ViS6qF8cS4iDl2a+diQ/4R9Vhl6rQuGyv9+232yC8g=; b=OYU8ZF2zdvrIo7CpzyaN+DCI8M81WTjAzwuBRxV9RpWObIxDyFh7Cl9t7hTN06YMYW p9w99Yxw9aQ8htkL0GfrFZBD0aOmUdG7Yy8lElIXHR3RAaqMM9RPCN8f3SUOSxoMCcWU bckTiWiRYOq73hcKY1YITjUIDnYOGx7RiwHQVFmGCbzzoPCczMTHLfiL1BcSNqYO9I+F F7gG8KVRdTRB+4vGyYa5nxo7dJSsrfQu+B70l1L6xdzPlN49aoMOp/pf+r6Bc9AOvWg6 k8lX8CxSCY8PTEFoSywY2IhbxCfkXevHNprakVBMdt+curQXJs3CoEE9ArSpNVlExj3G Bo1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pYx6AAYX; 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 e132-20020a63698a000000b0053f1af91622si2771541pgc.579.2023.06.09.08.07.57; Fri, 09 Jun 2023 08:08:10 -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=pYx6AAYX; 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 S241629AbjFIOy2 (ORCPT + 99 others); Fri, 9 Jun 2023 10:54:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36804 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241616AbjFIOyX (ORCPT ); Fri, 9 Jun 2023 10:54:23 -0400 Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1C2B73A84 for ; Fri, 9 Jun 2023 07:54:18 -0700 (PDT) Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-3f6d38a140bso14621065e9.1 for ; Fri, 09 Jun 2023 07:54:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1686322456; x=1688914456; 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=1ViS6qF8cS4iDl2a+diQ/4R9Vhl6rQuGyv9+232yC8g=; b=pYx6AAYX31qs1F2OdJbIgSLF5yMv3UfFa3oRnRll8KhhrmjwB3eEme0y1/+w3+P5bg idMNOEjcnlLemtdf/DSiN/3bybugS+OpaCxhTS/w7CXjZ9OwnE6bm/G89LRJQFiV4yzD hEJYKN0j72BaoMJuD/kUZbWg+yXlp1pUO+mmU40Y3H3kugF/792D1SskLtB9BFtflClQ fesCobyMVy3iaixO7aJFfh7MzgsF2nVbuPn9CHQ+ZIRGcj8+fGjAvTvCZJypMro1e9sS 6Umvo4fTd8nEamBKl8wWca8/pKDVdU3YlnN5Vo80gFlB5Av89qsqtjwaQGSVX1FhoYit mokw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686322456; x=1688914456; 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=1ViS6qF8cS4iDl2a+diQ/4R9Vhl6rQuGyv9+232yC8g=; b=fD5gPrw+cza/e+zSOTGaRQva0KjSbOILzaIEDkp+ECEl9PvyLXOUhKbi6Hvu/2wKVh c4fg2zzSAGgl5xUkUkp94bXbSV5GDUOet+6BxuMZWVn3Gl+pVpbBIn9XfKuAUiyWHXm0 5Lm9Ndk97jqtPd82gRP2EHkLCVVWtKzSvEwFthe5NqJ6KcwutxoW3QKrMQRVJQkRAxMv tN0AzmQh8J0Ube2Gl2540RfOPe4WDZ/gDXoqJIn/idHBxWH4Sh8l2OlMJZLji5dBrnaA 3SU3cIuhKqA/ZyPogqgkMsmwWHNcXP3Sj5l/oWNYR1WB2X7VV6EtifaLNJL5oVlMwJ3P ks6A== X-Gm-Message-State: AC+VfDyPxNZoR89Lx/yC+sMm/85hn6vTro7qEd1ytqP1KIvkzzC1WVpF 0dq4169jHFsOfzvtSCwIv+bUAA== X-Received: by 2002:a05:600c:3b29:b0:3f7:ec1d:21b3 with SMTP id m41-20020a05600c3b2900b003f7ec1d21b3mr4169683wms.5.1686322455438; Fri, 09 Jun 2023 07:54:15 -0700 (PDT) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id c21-20020a05600c0ad500b003f7310a3ffasm2946632wmr.2.2023.06.09.07.54.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Jun 2023 07:54:14 -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 v2 01/11] ASoC: qcom: SC7280: audioreach: Add sc7280 hardware param fixup callback Date: Fri, 9 Jun 2023 15:53:57 +0100 Message-Id: <20230609145407.18774-2-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20230609145407.18774-1-srinivas.kandagatla@linaro.org> References: <20230609145407.18774-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,URIBL_BLOCKED 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 Co-developed-by: Srinivas Kandagatla 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