Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp4222845rdb; Thu, 14 Sep 2023 16:09:11 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEqKtDq62ALixh0t5uPd06/nH8O5uRUfKDv6CClJGD7WrWV1c0O/haK7EFtsC5j8dXN8TUg X-Received: by 2002:a17:902:d50b:b0:1c1:fbec:bc32 with SMTP id b11-20020a170902d50b00b001c1fbecbc32mr7540157plg.6.1694732951588; Thu, 14 Sep 2023 16:09:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694732951; cv=none; d=google.com; s=arc-20160816; b=prP5TkJWIiVYLgW4IkmTdXZiE6F4zmXxi4MyrdRNstpZiMh4RWjHyz6ZFdYJ+qq1lj +L305q/VP8VRfGhyNyj2GtUasASidQx8sjrfuYdnCzcsjIxyIGWnQzdNpRSOJJp9i17+ uNtI2tCbIevVJAjeYIZIa7pYKb2Z1vP+NlqUeYI4+MZQNNWPk2reoLpBn8/DXs+NB2l2 QL15/c4u0ws7qqmKhzrDeYR8qQpgUZHzSfIcb7MZm5wyS2+pULSn3JW3wt5AmvQCoAyZ 2pM0f4TD2wwk8Iu9tkjPh5youbNnULepMx5cbbSxbQtchezlVkyOuhcqw5TkobSHPp55 /99g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=oxw8UGoxWAKPeFRYH8/soFo0chAZTNm45vShNklDO6U=; fh=+/DzR/shtn859kA9twsgbLwV1z5MglYuHp6J65I2G0k=; b=flkLcSwwERSZouLtGid3KiY00JRzGLRqK9dTU234iJlh+r1JndvBY1Opp88str6m2Y Q9yCr5sEQVTQ3Cc04apIn3tZnEQypFgntrJr/kWWKHeShD4mEHK844WdkcuuoHWkm8wQ 8oEWspqCt+LPdixOxlxyzzHGGIzsymc+GJh9/8KRg7Bkst88ieVPr77VE1KpNoejWQs2 cWVShOrXFQVR6LYq7igU9doz6WFBoemZsqDY29Hb9jZVLmyeOJoolY5YqkbmuIGWyKd3 XmgsZZ+9ZMSiiI4c8FGSU5CzRaH6npZ5DRx/31awIjmi+wqZJLk+8ML9JVWMLxBPracb 8bNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cirrus.com header.s=PODMain02222019 header.b=RcGMDv8Q; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=cirrus.com Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id j14-20020a170902da8e00b001b82da85c5asi2568860plx.336.2023.09.14.16.09.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Sep 2023 16:09:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@cirrus.com header.s=PODMain02222019 header.b=RcGMDv8Q; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=cirrus.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id A26E38245A54; Thu, 14 Sep 2023 02:21:46 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234853AbjINJVr (ORCPT + 99 others); Thu, 14 Sep 2023 05:21:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33068 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230515AbjINJVp (ORCPT ); Thu, 14 Sep 2023 05:21:45 -0400 Received: from mx0b-001ae601.pphosted.com (mx0b-001ae601.pphosted.com [67.231.152.168]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C4CB0CF3; Thu, 14 Sep 2023 02:21:41 -0700 (PDT) Received: from pps.filterd (m0077474.ppops.net [127.0.0.1]) by mx0b-001ae601.pphosted.com (8.17.1.22/8.17.1.22) with ESMTP id 38E74PZe017688; Thu, 14 Sep 2023 04:21:09 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cirrus.com; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=PODMain02222019; bh=oxw8UGoxWAKPeFR YH8/soFo0chAZTNm45vShNklDO6U=; b=RcGMDv8Qt9qEv5EQp4eHjYbr1rtU6JG OK+5VijZki3iu1ileEtmxCOUay/kr3nB+TE4+2FXSrZ++Al22uaxwk6Ha/NFaGVo CBxjTAEeNUZmEeko5k0/auAE5XRd6f6uEXRfRNy8pZrB6GGvu1eERB513M34m+42 FFErqwQfVzTGxMsxRztzOe8VLLNlu4/9h+2aIXoDbd95oC82RTIvE6axQ1CRrN73 xX2IlmX7nQnms64EJoR+Il6nGTnm8iqs/8f7yMDCkkU9F/8Ut5YT/oITqDSRi1zE SyD8YBssvPUsFoh6XVu9FPAVn9zj1bP8JRgVYg+Z4RhcC9gV9qV5FPQ== Received: from ediex02.ad.cirrus.com ([84.19.233.68]) by mx0b-001ae601.pphosted.com (PPS) with ESMTPS id 3t2y7shvxv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 14 Sep 2023 04:21:09 -0500 (CDT) Received: from ediex01.ad.cirrus.com (198.61.84.80) by ediex02.ad.cirrus.com (198.61.84.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.37; Thu, 14 Sep 2023 10:21:07 +0100 Received: from ediswmail.ad.cirrus.com (198.61.86.93) by ediex01.ad.cirrus.com (198.61.84.80) with Microsoft SMTP Server id 15.2.1118.37 via Frontend Transport; Thu, 14 Sep 2023 10:21:07 +0100 Received: from ediswmail.ad.cirrus.com (ediswmail.ad.cirrus.com [198.61.86.93]) by ediswmail.ad.cirrus.com (Postfix) with ESMTP id D24C43563; Thu, 14 Sep 2023 09:21:07 +0000 (UTC) Date: Thu, 14 Sep 2023 09:21:07 +0000 From: Charles Keepax To: John Watts CC: , Liam Girdwood , "Mark Brown" , Rob Herring , "Krzysztof Kozlowski" , Conor Dooley , Jaroslav Kysela , Takashi Iwai , , , Subject: Re: [PATCH v2 1/3] ASoC: wm8782: Handle maximum audio rate at runtime Message-ID: <20230914092107.GR103419@ediswmail.ad.cirrus.com> References: <20230913171552.92252-1-contact@jookia.org> <20230913171552.92252-2-contact@jookia.org> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20230913171552.92252-2-contact@jookia.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-Proofpoint-GUID: T3VcIRVcK4-DQjHEfsYVgIDZjWmiGY1K X-Proofpoint-ORIG-GUID: T3VcIRVcK4-DQjHEfsYVgIDZjWmiGY1K X-Proofpoint-Spam-Reason: safe 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 (howler.vger.email [0.0.0.0]); Thu, 14 Sep 2023 02:21:46 -0700 (PDT) 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. Thanks, Charles