Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp1141863rda; Mon, 23 Oct 2023 04:07:31 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGnJvhxRx0FOhinXGYEbwxEvtXtd1r9cLF2CfdCA9BTXA5x7gun4bxIgrocyPHA1rUcd6mV X-Received: by 2002:a17:902:f251:b0:1ca:8b90:1cbd with SMTP id j17-20020a170902f25100b001ca8b901cbdmr5270691plc.0.1698059251387; Mon, 23 Oct 2023 04:07:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698059251; cv=none; d=google.com; s=arc-20160816; b=o8dOFNHYvWMkmZIK9SiV2BUM3sMA/Ev4MYbg2ZOrMeggi2MCq2dB19aOc9VRXb9XYm G1JtAm3G6krtKGKrKdoHXhVLYt9XXX56nNn27n/jJ0sH3m12BELFiTU09QQ8UZUX7ovL aBzNJSVSE8lMjOlV//ZnkNABDOGfu82J3uCKTRNutj+ODqLIsjTq5iditB0C59YspX8G LsvdokZ29NjAh0SkwjukZM2cuf5qE6mfjYhpaex0Typgzuyn95aDMUqPC+o4VzQ5cQD9 XKni+Ixm4JQrl10Zytlo/bVSKghYY+GynpjbtasYPKB9imdNFnxePGbvIgPNhSICVk/U 7t3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:to:content-language:subject:user-agent:mime-version:date :message-id:dkim-signature; bh=8/Y0TcoHGjvS9UkTGXSKAMG9qsDihb5aIo76yk/OMtY=; fh=qKTzptlUDzifbkhmmV2BF0eHk3Tq/g9QDYrt0FTkDTM=; b=hirgZez5AqiQnybSyZDBpcWZARZYF5HfGmyP5s/tZ1t1n+0EQvHoSQs8KhEtS8MAkm pmzY6ciSvvLFD9zE/zG8TGDiWfSFzHuy01Lu4EeZ8rArjTYLI4wcHkYm6EJg8KkRT7p2 se5/tDEmGlC5CxVRxieiMnL9fkQy5oHy1XjjAvPk59gwM9P5t+7MHa12Xqf4wsjmDYHY c2gFlNSv+gFMMXR/fI7+doDPhCShKsSFBKQ4hrNl8ND5pSGOhN9EVuLbxn+CNt765kSB pstb0LiUdzhxOB2usqS3yL1DXOb6dExaICbYwZM0NCLDgUn9B2Huxkj9GyVTOUKCP9pF 8Asg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=ZmpjuItu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id d8-20020a170902654800b001c7755dccc7si5904186pln.632.2023.10.23.04.07.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Oct 2023 04:07:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=ZmpjuItu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id E153A804C6D7; Mon, 23 Oct 2023 04:07:28 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233422AbjJWLHI (ORCPT + 99 others); Mon, 23 Oct 2023 07:07:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57748 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233406AbjJWLHG (ORCPT ); Mon, 23 Oct 2023 07:07:06 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 82E4DD7F for ; Mon, 23 Oct 2023 04:07:04 -0700 (PDT) Received: from [192.168.1.100] (2-237-20-237.ip236.fastwebnet.it [2.237.20.237]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: kholk11) by madras.collabora.co.uk (Postfix) with ESMTPSA id 8195F66056D1; Mon, 23 Oct 2023 12:07:02 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1698059223; bh=ZPYct6TKPhXnwWujFdM+whLqN4S0h84pY9ooYkcyhfU=; h=Date:Subject:To:References:From:In-Reply-To:From; b=ZmpjuItuKqDzcvKhkTGQ3aOxdbFgtc9cKGZmWMS2Pl2MP66OX0vrBjUF2t9m5hpSW 8baH8ixIFNnK3661E9pO6zpI6M1wPVoo8txnxIPC2ZtGAl6jPTVIKEetRb5L+77Xmw l1YjXzrrSNtubejjbOmTPVkzZltSqYNH65Xm8j+JUuua7tyYkfXYn7vg1A9dmwjatk eb6PsUzZyKaxJp1Niy538gGG0ejv8ZU76Uux3lkR4r3HXreHsZcWs9H09iiluK6rUG 6fifRdjbUbyRuanhPkA3Vgo4jewDrPDUaIEZlbB2xxER9X4+frxPSBN6ThhKzV1j+c aRscoCphKQPxg== Message-ID: Date: Mon, 23 Oct 2023 13:07:00 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 2/2] ASoC: mediatek: mt7986: add sample rate checker Content-Language: en-US To: Maso Huang , Liam Girdwood , Mark Brown , Matthias Brugger , Jaroslav Kysela , Takashi Iwai , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org References: <20231023095453.4860-1-maso.huang@mediatek.com> <20231023095453.4860-3-maso.huang@mediatek.com> From: AngeloGioacchino Del Regno In-Reply-To: <20231023095453.4860-3-maso.huang@mediatek.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Mon, 23 Oct 2023 04:07:29 -0700 (PDT) Il 23/10/23 11:54, Maso Huang ha scritto: > mt7986 only supports 8/12/16/24/32/48/96/192 kHz > > Signed-off-by: Maso Huang > --- > sound/soc/mediatek/mt7986/mt7986-dai-etdm.c | 22 +++++++++++++++++---- > 1 file changed, 18 insertions(+), 4 deletions(-) > > diff --git a/sound/soc/mediatek/mt7986/mt7986-dai-etdm.c b/sound/soc/mediatek/mt7986/mt7986-dai-etdm.c > index e523d33846fe..270852ce3dd9 100644 > --- a/sound/soc/mediatek/mt7986/mt7986-dai-etdm.c > +++ b/sound/soc/mediatek/mt7986/mt7986-dai-etdm.c > @@ -237,12 +237,26 @@ static int mtk_dai_etdm_hw_params(struct snd_pcm_substream *substream, > struct snd_pcm_hw_params *params, > struct snd_soc_dai *dai) > { > + unsigned int rate = params_rate(params); > struct mtk_base_afe *afe = snd_soc_dai_get_drvdata(dai); > > - mtk_dai_etdm_config(afe, params, dai, SNDRV_PCM_STREAM_PLAYBACK); > - mtk_dai_etdm_config(afe, params, dai, SNDRV_PCM_STREAM_CAPTURE); > - > - return 0; > + switch (rate) { > + case 8000: > + case 12000: > + case 16000: > + case 24000: > + case 32000: > + case 48000: > + case 96000: > + case 192000: > + mtk_dai_etdm_config(afe, params, dai, SNDRV_PCM_STREAM_PLAYBACK); > + mtk_dai_etdm_config(afe, params, dai, SNDRV_PCM_STREAM_CAPTURE); > + return 0; > + default: > + dev_warn(afe->dev, "%s(), sample rate: %d is not supported\n", __func__, rate); > + dev_warn(afe->dev, "%s(), only support 8/12/16/24/32/48/96/192 kHz\n", __func__); That's better: dev_err(afe->dev, "Sample rate %d invalid. Supported rates: 8/12/16/24/32/48/96/192 kHz\n", rate, __func__); after which, Reviewed-by: AngeloGioacchino Del Regno Regards, Angelo