Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp393082rdb; Fri, 6 Oct 2023 06:47:44 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHqtRTe2cMdGxpJ+rS2rSO/Z0tRMTJxUAmVX4o5KORHliLaFe+cXXvYg8W1efHe06o2wucF X-Received: by 2002:a05:6a21:339d:b0:16b:c20d:fcd1 with SMTP id yy29-20020a056a21339d00b0016bc20dfcd1mr1828393pzb.21.1696600064193; Fri, 06 Oct 2023 06:47:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696600064; cv=none; d=google.com; s=arc-20160816; b=0mAYEumVI8WhICB6XIfOvdcq7xckDRx5hhLpLi4wrAOpjggOOhofrAmHyX8bPCvE8F XZ7+7U1x/vqIwuDJEuUPVLLP9xrE67w+UucSKHC2l7JsCPQvNYQTabw31sS9tXDTrPN+ ibbIlSZoJaa+tgVxh9hAh3BPk1Gs8FG2Qj/ocQ17BPDxvDQ5kiaXPxMU0YSCiOBqPF/u EHC7YuFLtucDXANfjXknAu6l16P6/Z7wwhl3BCnspDcqPY6IR48sW6l7qMGeXvDRTQ0G E/pAVLTsXLLl95koZCziXTtWet/Iy9yROJB3KqmAToMB+sTrcVGqCJpBfcdbZFpE5Yb0 57EA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=Gs9kODHBf7pe1hvttMIGP4XQeIHebOI3TikCUwTzhsU=; fh=9EmQy3nV+j7AYsabaDMwbPlRU7+uz1cdK9KYarw9f+c=; b=EgyBN0r5DM/VgH1qJNNLUQpZx5IS0KyGtPtxvviaOKPGaywBHjtRKrefNQ1hMWncP9 JWIdLpKK+/RFL8jQkU+lahky+UHR8LdUPCVw0bGUFr2r55kgtvxZjbnV2IgXbRQmmjzA /1RpnsKJbz/B5KavK3/iOBDCaYAPTPuw0nFEZGcMD9idznCD25M2n/KFK29wTs9uh4Bb dnGujBalmJlhb7zb2ktc+XbFVB4gY5EtVoi8a7vWoAmIsIdzeTUg+RXcnJn+G3khgjEB eHi6Ps+u1igGjmgqgJP5/FSsuJV4f49LQcsR2lLHwMrC9I7DrOpsSOlywF/YcxZ9TlIe YQng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Hw1Xj9YD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id m2-20020a056a00080200b00690c1a57210si1549129pfk.115.2023.10.06.06.47.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Oct 2023 06:47:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Hw1Xj9YD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 056E9805DC17; Fri, 6 Oct 2023 06:47:43 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232698AbjJFNrf (ORCPT + 99 others); Fri, 6 Oct 2023 09:47:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35442 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232662AbjJFNrD (ORCPT ); Fri, 6 Oct 2023 09:47:03 -0400 Received: from mail-lf1-x12a.google.com (mail-lf1-x12a.google.com [IPv6:2a00:1450:4864:20::12a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 13C8D10E7 for ; Fri, 6 Oct 2023 06:46:30 -0700 (PDT) Received: by mail-lf1-x12a.google.com with SMTP id 2adb3069b0e04-50325ce89e9so2817712e87.0 for ; Fri, 06 Oct 2023 06:46:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1696599989; x=1697204789; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=Gs9kODHBf7pe1hvttMIGP4XQeIHebOI3TikCUwTzhsU=; b=Hw1Xj9YD8xe61mktLwaUCSoVaZFQprx2cR9WnnpaU3VFI5HuK8cCfMBuTkdjkCclva US3Ug5bxW+Z/ECcWRllOfLgJ+BoAqy3T3UDRuM0zzGfv84+RM6a/fk+JJ6DdrPX7HscN QS+mGvd0LIrlK8JBwJ3D3sAsFxSSM2pbxP6xiJ4+fAV4dqZ6naG7bUFnyFB8Psa20EtD Es5RipMrx3jMvhDnsTPJLTWpehMDU9JMbOBqQZDzfoiC58hWno2C54fUTO3/zryrxbiF oCcjbv5E1Jy+VMqCPO5OedugsZXCyvmgNFykVLZiO6nFi7iBwcNxR3i59ZkLpiTPdyhS ptBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696599989; x=1697204789; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Gs9kODHBf7pe1hvttMIGP4XQeIHebOI3TikCUwTzhsU=; b=ElbgLf1RwbOxlfeajR1d2WdNmBG5RcVSkzGtN7Pla2v9YmLOyY0e61/boI+O6avxxp hGT1hoiSkg7EGMySYDkCvygo+a9nwz1qaf8mCuY2mv7XHE2K7S1QrIT5Uywtywn+AR4L uY50NcS7y4eYBuXhJyRrLdQlu5wWMKcBcKskxWg+webvqlDt+VK6N0QJxNFE1XbMPo3l qruCudTlVdL+S3evZq8OOZxvDSi/zszd3R26zJaqwQIf9bhhiaCY5VcObLUjEA+3HYFW EZNmyKg2VypykgATvt3uXS04oDK9CcMbkNe0hM1IqoreaZB3l0khL4NtUJpgueUKx0JH YJlA== X-Gm-Message-State: AOJu0YxUOQ+bTWPgYiWTaR0wGubZpy7p0rR6evksmgfoU61JDGmVg8kX G1rC/06VTGH+OhSp6FGNkFSMtg== X-Received: by 2002:a05:6512:238a:b0:502:a588:6609 with SMTP id c10-20020a056512238a00b00502a5886609mr9257631lfv.3.1696599989015; Fri, 06 Oct 2023 06:46:29 -0700 (PDT) Received: from [127.0.1.1] ([85.235.12.238]) by smtp.gmail.com with ESMTPSA id v25-20020a197419000000b004fe37199b87sm308733lfe.156.2023.10.06.06.46.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Oct 2023 06:46:28 -0700 (PDT) From: Linus Walleij Date: Fri, 06 Oct 2023 15:46:25 +0200 Subject: [PATCH 2/8] ASoC: mediatek: mt2701-cs42448: Convert to GPIO descriptors MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20231006-descriptors-asoc-mediatek-v1-2-07fe79f337f5@linaro.org> References: <20231006-descriptors-asoc-mediatek-v1-0-07fe79f337f5@linaro.org> In-Reply-To: <20231006-descriptors-asoc-mediatek-v1-0-07fe79f337f5@linaro.org> To: Bartosz Golaszewski , Andy Shevchenko , Matthias Brugger , AngeloGioacchino Del Regno , Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, alsa-devel@alsa-project.org, Linus Walleij X-Mailer: b4 0.12.3 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, 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 lindbergh.monkeyblade.net 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 (snail.vger.email [0.0.0.0]); Fri, 06 Oct 2023 06:47:43 -0700 (PDT) The driver is pretty straight-forward to convert to use GPIO descriptors, however a separate patch is needed to accept the DT GPIO resources ending with "-gpio1" and "-gpio2" instead of the standard "-gpio" or "-gpios" name convention. Signed-off-by: Linus Walleij --- sound/soc/mediatek/mt2701/mt2701-cs42448.c | 54 ++++++++++++------------------ 1 file changed, 22 insertions(+), 32 deletions(-) diff --git a/sound/soc/mediatek/mt2701/mt2701-cs42448.c b/sound/soc/mediatek/mt2701/mt2701-cs42448.c index 08ef109744c7..81b695a19dc7 100644 --- a/sound/soc/mediatek/mt2701/mt2701-cs42448.c +++ b/sound/soc/mediatek/mt2701/mt2701-cs42448.c @@ -10,16 +10,15 @@ #include #include #include -#include +#include #include -#include #include "mt2701-afe-common.h" struct mt2701_cs42448_private { int i2s1_in_mux; - int i2s1_in_mux_gpio_sel_1; - int i2s1_in_mux_gpio_sel_2; + struct gpio_desc *i2s1_in_mux_sel_1; + struct gpio_desc *i2s1_in_mux_sel_2; }; static const char * const i2sin_mux_switch_text[] = { @@ -53,20 +52,20 @@ static int mt2701_cs42448_i2sin1_mux_set(struct snd_kcontrol *kcontrol, switch (ucontrol->value.integer.value[0]) { case 0: - gpio_set_value(priv->i2s1_in_mux_gpio_sel_1, 0); - gpio_set_value(priv->i2s1_in_mux_gpio_sel_2, 0); + gpiod_set_value(priv->i2s1_in_mux_sel_1, 0); + gpiod_set_value(priv->i2s1_in_mux_sel_2, 0); break; case 1: - gpio_set_value(priv->i2s1_in_mux_gpio_sel_1, 1); - gpio_set_value(priv->i2s1_in_mux_gpio_sel_2, 0); + gpiod_set_value(priv->i2s1_in_mux_sel_1, 1); + gpiod_set_value(priv->i2s1_in_mux_sel_2, 0); break; case 2: - gpio_set_value(priv->i2s1_in_mux_gpio_sel_1, 0); - gpio_set_value(priv->i2s1_in_mux_gpio_sel_2, 1); + gpiod_set_value(priv->i2s1_in_mux_sel_1, 0); + gpiod_set_value(priv->i2s1_in_mux_sel_2, 1); break; case 3: - gpio_set_value(priv->i2s1_in_mux_gpio_sel_1, 1); - gpio_set_value(priv->i2s1_in_mux_gpio_sel_2, 1); + gpiod_set_value(priv->i2s1_in_mux_sel_1, 1); + gpiod_set_value(priv->i2s1_in_mux_sel_2, 1); break; default: dev_warn(card->dev, "%s invalid setting\n", __func__); @@ -382,27 +381,18 @@ static int mt2701_cs42448_machine_probe(struct platform_device *pdev) return ret; } - priv->i2s1_in_mux_gpio_sel_1 = - of_get_named_gpio(dev->of_node, "i2s1-in-sel-gpio1", 0); - if (gpio_is_valid(priv->i2s1_in_mux_gpio_sel_1)) { - ret = devm_gpio_request(dev, priv->i2s1_in_mux_gpio_sel_1, - "i2s1_in_mux_gpio_sel_1"); - if (ret) - dev_warn(&pdev->dev, "%s devm_gpio_request fail %d\n", - __func__, ret); - gpio_direction_output(priv->i2s1_in_mux_gpio_sel_1, 0); - } + priv->i2s1_in_mux_sel_1 = devm_gpiod_get_optional(dev, "i2s1-in-sel-gpio1", + GPIOD_OUT_LOW); + if (IS_ERR(priv->i2s1_in_mux_sel_1)) + return dev_err_probe(dev, PTR_ERR(priv->i2s1_in_mux_sel_1), + "error getting mux 1 selector\n"); + + priv->i2s1_in_mux_sel_2 = devm_gpiod_get_optional(dev, "i2s1-in-sel-gpio2", + GPIOD_OUT_LOW); + if (IS_ERR(priv->i2s1_in_mux_sel_2)) + return dev_err_probe(dev, PTR_ERR(priv->i2s1_in_mux_sel_2), + "error getting mux 2 selector\n"); - priv->i2s1_in_mux_gpio_sel_2 = - of_get_named_gpio(dev->of_node, "i2s1-in-sel-gpio2", 0); - if (gpio_is_valid(priv->i2s1_in_mux_gpio_sel_2)) { - ret = devm_gpio_request(dev, priv->i2s1_in_mux_gpio_sel_2, - "i2s1_in_mux_gpio_sel_2"); - if (ret) - dev_warn(&pdev->dev, "%s devm_gpio_request fail2 %d\n", - __func__, ret); - gpio_direction_output(priv->i2s1_in_mux_gpio_sel_2, 0); - } snd_soc_card_set_drvdata(card, priv); ret = devm_snd_soc_register_card(&pdev->dev, card); -- 2.34.1