Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp3446857rdb; Wed, 13 Sep 2023 12:15:10 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHr5x/DeRofZEbCevAnU/cacuRMdCw/rRsybvEpCX8XQDqAiD/+0/NOe0pOh+9A/e5OoeWS X-Received: by 2002:a17:90b:1b04:b0:268:314f:8f35 with SMTP id nu4-20020a17090b1b0400b00268314f8f35mr2945263pjb.6.1694632509777; Wed, 13 Sep 2023 12:15:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694632509; cv=none; d=google.com; s=arc-20160816; b=I2KxQqLlCGKn+2x97pm58BfwpJhWe9RrAbjr/dJjq3MT8meOH89x9rzi/YVzwOqChm jglY0yfm6he8KOCrktRLbNcyDicJqsR/8TVHtJ3B9U2OTOL8zQNreZeLv6MjPe4DkmYe U7l67jmFe+jVO5tIvv1JJuBjgMJMYf5tGtsNxrS7NS2sbDwNMLwXw97ffbQ/lnDiyOOj Y3ABHw4s21inNyT1qsAkCvuoQa43oRiXgc4zaY1IU0wlCfMOwsFg+xkH0+BsMMZdcxMp Qj2OgoBpRhezOb55bGJLSSo2iOM8dCP2Ros4jacI8jcAt8NP4TjHp+5HljtIk2ES7iQE Wi7A== 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=3FeZkXz+JQqXeiU3HazldI8mgv0sJ787/pyCTmTegd4=; fh=K2LUYf+eeIUUOAFkE7bz3JhUBLdTtfJsbrtjFyoTvGs=; b=gucp7MbE+lprqjqttaDeOAch2keY7HwdgQpxkpo0P0vtFxILmOMRFTtQC4Jrz2QHf2 1vWtkUS668N8X83DNAsDasczZE+K7A6jbW+RG6QOzqBCGEwWilHtr26aS+Upt8pEIgvj Wplgy/jmkvOLdBLI+D8TGwBy4DuNa/ON1hQhoVVkzesl9SkTSsUVHONOq4h7KqYHgFdn 8K8FCyz2pI7pNV5eFqeVHRiavkl3mWmw3x20a93qQvYHxwROsDn5yThSc/1lHFCJK5d1 fwt14Or8RJirGqDJ1yk1fg7tm1ws+BqRMHnjcfzqR6uOFIMOPVTh/onfqKQ+hfcQ+jbm 2EOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@jookia.org header.s=key1 header.b=ZFkMudF4; 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 nl11-20020a17090b384b00b0026b47b87042si2360707pjb.35.2023.09.13.12.15.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Sep 2023 12:15:09 -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=ZFkMudF4; 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 3379B8113429; Wed, 13 Sep 2023 10:17:21 -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 S231206AbjIMRQp (ORCPT + 99 others); Wed, 13 Sep 2023 13:16:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43180 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231849AbjIMRQ1 (ORCPT ); Wed, 13 Sep 2023 13:16:27 -0400 Received: from out-211.mta0.migadu.com (out-211.mta0.migadu.com [IPv6:2001:41d0:1004:224b::d3]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0A0D1DC for ; Wed, 13 Sep 2023 10:16:22 -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=1694625381; 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=3FeZkXz+JQqXeiU3HazldI8mgv0sJ787/pyCTmTegd4=; b=ZFkMudF4vLRf2wwyLkRMjGNESmuzTssdLkRAglApAJ8yPv6gK4CSmiVmSozhR/msO9T1X0 cwe809Oob+FAKFsjPNz50zFhGBQ6/MCMc1ZqLlbRyDxgja44nq1wiNyMteDtGAob8nGyaR 5ImsryHJjxA4FjkZpt6MY9Hi3jc7QgOLDHRYjP0oZj9ntRl9OdCRjCGGJTBvNDI7CnYOZx FOb9TDIIXM03aX7F+vEO2AP+PNTKhYSIlmGy1TYSmYKNeUMbI0/XCxvfLNV13unO0eurm3 X5O334si6FTqxRHh0IBJoZ9i+yGS3mhJ6pvlWEJo5n/we4vWKmDit3H4xCe/Rg== From: John Watts To: alsa-devel@alsa-project.org Cc: Liam Girdwood , Mark Brown , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Jaroslav Kysela , Takashi Iwai , John Watts , patches@opensource.cirrus.com, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 2/3] ASoC: wm8782: Use wlf,fsampen device tree property Date: Thu, 14 Sep 2023 03:15:51 +1000 Message-ID: <20230913171552.92252-3-contact@jookia.org> In-Reply-To: <20230913171552.92252-1-contact@jookia.org> References: <20230913171552.92252-1-contact@jookia.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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]); Wed, 13 Sep 2023 10:17:21 -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 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 --- 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 63ab63f3189a..249b58b093d6 100644 --- a/sound/soc/codecs/wm8782.c +++ b/sound/soc/codecs/wm8782.c @@ -122,8 +122,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) @@ -139,8 +140,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