Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp3816908rdb; Thu, 14 Sep 2023 03:44:35 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFCpVjKAJi5I4QkfPkf60RlPwdP6zQFG3kg1DKbY4O+VXoI4AHtDtfVDGSIFPAMKVndR2P+ X-Received: by 2002:a17:90b:1892:b0:273:f017:cac0 with SMTP id mn18-20020a17090b189200b00273f017cac0mr4594417pjb.39.1694688275381; Thu, 14 Sep 2023 03:44:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694688275; cv=none; d=google.com; s=arc-20160816; b=BU1LROReszLYhPIYaeeuHK3mCArlQxrpIx+E/QJpQ+8B15AjO8CmLB+QzQGewelpe1 cYlQo/LFTqGm6rqJzt9r5f7HCYzgLzq0nWpJYEDnRDmBcafXf+HESQrsmERJFmyx9+n3 4d7rFQozOamA0HQzzYPKMvEckAZMenke9Q5hgylmIqp50rwOSuoks9iOpCQTh2sFe5ML qlhDEkBWLlz37mRiFCrx3yc7+Vwqa5zZp5oNMiXJVC9JgnEaV09QoNdSFK8ZOjNijNpl qMOJM5FOfkQOzV1lREb1oWSbjg07gpaE27ItiLG56PEKlvYSzHJF4u/8jveoKGXU4BCH ATVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:dkim-signature:date; bh=vmPa+r4UrqSI4OyMQhsi2Wq5TKQmIhNTWv2ugXVReZk=; fh=m8CyJ1OWMnDF5PMtzJrFFlxuV6/GjsP0Ir2wtUNQaoA=; b=xTeO7B6E+aWDHfKezS2lYMDCvlkvdwuaclOuE5ptT13GC/XHNI+ao4kjZhZA1FAO6V L4+YUhoSVwlUq1axQp2JQuzH0gomNNkF4xLwzDP5U/XJ70jdc3T7Sl17GIMw5PaatRSY 2ZONfovuBm9Zob0vdqc2Fnqs9O0aBzNZQlnQqWp02ivlGL8fd9TLbliviJTvDnDDsGU5 GrITMhXJA3FchR+/qizbGErVNtD1xyuJfOHFQMfiLye0MIeH7vvVRKzz7pDHFoW1pjUt yEVp7K8GDp5phNOtmZtmkfsP9Yu3QtfjZuDniU5gAlmrbtO1WDIh1IWJOvQ1y3uCfweV QNmQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@jookia.org header.s=key1 header.b=mqea8Dco; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=jookia.org Return-Path: Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id lb4-20020a17090b4a4400b0026b0b359a82si1598105pjb.4.2023.09.14.03.44.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Sep 2023 03:44:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@jookia.org header.s=key1 header.b=mqea8Dco; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=jookia.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 3E6D080DB4CD; Thu, 14 Sep 2023 02:31:54 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236930AbjINJbx (ORCPT + 99 others); Thu, 14 Sep 2023 05:31:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47996 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235604AbjINJbw (ORCPT ); Thu, 14 Sep 2023 05:31:52 -0400 Received: from out-222.mta0.migadu.com (out-222.mta0.migadu.com [IPv6:2001:41d0:1004:224b::de]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8B089CC7 for ; Thu, 14 Sep 2023 02:31:48 -0700 (PDT) Date: Thu, 14 Sep 2023 19:27:03 +1000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jookia.org; s=key1; t=1694683906; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=vmPa+r4UrqSI4OyMQhsi2Wq5TKQmIhNTWv2ugXVReZk=; b=mqea8Dco5GkiVp3d+wmxmrg67/ao1nY64YhP2JCR+VosQ6HsA5pdF5EP+IMKNcOfvAkHDh JSbCKG24sH0K2Gbc1pwDeCvd2Y+kIS1DOdjSkSX3BkXvArTN36u1OTiDRr5KvQrz1def6i YoPsCEptgGxC/s4Ep7cAwC7qVtq3CTmGWiHLmEgmqzGAG08iJCsLq/ykteyK2nxamCfhwQ 3xi4D3moJXUHTs7IGutAy/+oNofpaZjLQMsb8FBUKaMj4y+YeFpIbj5ZngStaPQgkavLma ayx+AH+lwFfUGuOZhiMtJtID6PAQIpVYb1FgRTtkA5/wvvd1pfvKrC55Awm/ng== X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: John Watts To: Charles Keepax Cc: alsa-devel@alsa-project.org, Liam Girdwood , Mark Brown , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Jaroslav Kysela , Takashi Iwai , patches@opensource.cirrus.com, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 1/3] ASoC: wm8782: Handle maximum audio rate at runtime Message-ID: References: <20230913171552.92252-1-contact@jookia.org> <20230913171552.92252-2-contact@jookia.org> <20230914092107.GR103419@ediswmail.ad.cirrus.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230914092107.GR103419@ediswmail.ad.cirrus.com> X-Migadu-Flow: FLOW_OUT 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 (morse.vger.email [0.0.0.0]); Thu, 14 Sep 2023 02:31:54 -0700 (PDT) X-Spam-Status: No, score=-0.9 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 morse.vger.email On Thu, Sep 14, 2023 at 09:21:07AM +0000, Charles Keepax wrote: > On Thu, Sep 14, 2023 at 03:15:50AM +1000, John Watts wrote: > > The wm8782 supports up to 192kHz audio when pins are set correctly. > > Instead of hardcoding which rates are supported enable them all > > then refer to a max_rate variable at runtime. > > > > Signed-off-by: John Watts > > --- > > +static int wm8782_dai_hw_params(struct snd_pcm_substream *component, > > + struct snd_pcm_hw_params *params, > > + struct snd_soc_dai *dai) > > +{ > > + struct wm8782_priv *priv = > > + snd_soc_component_get_drvdata(dai->component); > > + > > + if (params_rate(params) > priv->max_rate) > > + return -EINVAL; > > + > > + return 0; > > +} > > We should be setting this as a constraint in startup, rather > than returning an error in hw_params. That will let user-space > know the supported rates and allow it to resample if necessary. How do you do this? The struct with the rate is statically defined. > > Thanks, > Charles John.