Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp330490rdb; Mon, 18 Sep 2023 17:16:23 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE+jnSEHVIOeocEvRVabNkT+12vi9I/snAFyZebhFrxv1JCwHYVVpxR3fHFkuVf4UUj/Axu X-Received: by 2002:a05:6871:552:b0:1bb:8ab6:6642 with SMTP id t18-20020a056871055200b001bb8ab66642mr13710067oal.8.1695082582850; Mon, 18 Sep 2023 17:16:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695082582; cv=none; d=google.com; s=arc-20160816; b=iA1q1pnMaiQZqQTbXkc/VyKaeAxuJ/CRovK6LbPdABOkkFyCsT3FYmTvK/LF/l7JEd Expm5A+BZCnl8Ff58AuSprMzrF9N1TEYgYiu0ka1jHnlk35RBoVwxiJwIErCF6Yyatw4 LLbncJlP/2g8ctY9Z8JFl8KBqK2aA2TyMw9lbrz8wOFvqPpBrmVGJhVSOxjv+07HK/lF Am3D2YCmNM3b3vtTay8hOMe8c98lFwaojQh1oGvNwycBy67KlzkB70wsIQ/82P8hxEun UGm0t9EwmBxLbm8XM6x2/uViflWRZZRwZ6ZFatCzH1CCRUcMROCNxoU1Auhx8yhwuibg OS8Q== 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=4QFpVPz6Dj2StxlRB+kfzhXVotf0zGse0COR5Gm2ZtU=; fh=o2U44G9A4LTpJ59K7pAEIGHu4kjGtR8t+y7j7b/fsto=; b=nHy082bGDcQdzns9Sm5Q1FNzeZi4Jxs3Dq1e+Ttbs4w+OGlZjWtzMdpvL846VQ6IYY lfEtsjLGA8WswBTq1eIk32v2xsrb/7VPBu+P4dWzmbBbK3s+PZCtadS9uXf6hu4g3tYO hIuptgG147TA+JLJHjXa91834IZ5xRF5LqhbT5Exb5hJgC5DSgEza8sEYenWuFWiI5Mu tw9olokaVgAKyR3xL0KFvjNo1PHwxNENXKrwdl6S0UFueWKyS4AUMs5swlbReX+dxxq4 g1xqJuJBWwunCpZSkggMHPzZbGR4bbekd9QDPETGhS3AFbxK54afXS++/edkdQ4aJrzA 6aFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@jookia.org header.s=key1 header.b="SE9BSu6/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 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 groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id t5-20020a17090ad14500b00262f7dccaecsi8635267pjw.170.2023.09.18.17.16.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Sep 2023 17:16:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@jookia.org header.s=key1 header.b="SE9BSu6/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 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 groat.vger.email (Postfix) with ESMTP id 9D4EE8108BD8; Mon, 18 Sep 2023 08:23:58 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240226AbjIRPXl (ORCPT + 99 others); Mon, 18 Sep 2023 11:23:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43422 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240561AbjIRPXe (ORCPT ); Mon, 18 Sep 2023 11:23:34 -0400 Received: from out-223.mta0.migadu.com (out-223.mta0.migadu.com [IPv6:2001:41d0:1004:224b::df]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8959810E3 for ; Mon, 18 Sep 2023 08:19:33 -0700 (PDT) X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jookia.org; s=key1; t=1695042958; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4QFpVPz6Dj2StxlRB+kfzhXVotf0zGse0COR5Gm2ZtU=; b=SE9BSu6/4xhSdGqLkCq7BClR4+SWO4YbbsABZP/UR+5ItB9hbFerzMeBdcdLlSL7FLqy6x liihzn367XnuIFSbIjQ+oOgsAJeegWiY9/bhcfCTXR1tiPX2u7paDd5n7IQ90dFGt6/sQH 33T4dU66rpYhoSrt3ZzqUmZHgBNXakoZrCufRnUXs6h/1g8PhjOf4PqFqvDwiNptQlBP3X /s3H9GF/Ekhh26gNc2QNEh6qha+UXeVhzLoEge/WmokXZnt40vIpQi3rcyTxay8AfiYG0S VF0UMOlMDd1rrB+mmazdq7GIJ5RJ9q438Zz3KFGlt99GY/t+JVkZ0iEFW6HntQ== From: John Watts To: alsa-devel@alsa-project.org Cc: Liam Girdwood , Mark Brown , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Jaroslav Kysela , Takashi Iwai , Charles Keepax , John Watts , patches@opensource.cirrus.com, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 2/3] ASoC: wm8782: Use wlf,fsampen device tree property Date: Mon, 18 Sep 2023 23:15:31 +1000 Message-ID: <20230918131532.2257615-3-contact@jookia.org> In-Reply-To: <20230918131532.2257615-1-contact@jookia.org> References: <20230918131532.2257615-1-contact@jookia.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT 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 groat.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 (groat.vger.email [0.0.0.0]); Mon, 18 Sep 2023 08:23:58 -0700 (PDT) The wm8782 supports rates 96kHz and 192kHz as long as the hardware is configured properly. Allow this to be specified in the device tree. Signed-off-by: John Watts Acked-by: Charles Keepax --- sound/soc/codecs/wm8782.c | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/sound/soc/codecs/wm8782.c b/sound/soc/codecs/wm8782.c index f3dc87b92b1e..3a2acdfa9b85 100644 --- a/sound/soc/codecs/wm8782.c +++ b/sound/soc/codecs/wm8782.c @@ -119,8 +119,9 @@ static const struct snd_soc_component_driver soc_component_dev_wm8782 = { static int wm8782_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; + struct device_node *np = dev->of_node; struct wm8782_priv *priv; - int ret, i; + int ret, i, fsampen; priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); if (!priv) @@ -136,8 +137,26 @@ static int wm8782_probe(struct platform_device *pdev) if (ret < 0) return ret; - /* For configurations with FSAMPEN=0 */ - priv->max_rate = 48000; + // Assume lowest value by default to avoid inadvertent overclocking + fsampen = 0; + + if (np) + of_property_read_u32(np, "wlf,fsampen", &fsampen); + + switch (fsampen) { + case 0: + priv->max_rate = 48000; + break; + case 1: + priv->max_rate = 96000; + break; + case 2: + priv->max_rate = 192000; + break; + default: + dev_err(dev, "Invalid wlf,fsampen value"); + return -EINVAL; + } return devm_snd_soc_register_component(&pdev->dev, &soc_component_dev_wm8782, &wm8782_dai, 1); -- 2.42.0