From patchwork Fri Aug 25 08:12:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 716898 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7C8AAC3DA66 for ; Fri, 25 Aug 2023 08:13:56 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 4B45D851; Fri, 25 Aug 2023 10:13:04 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 4B45D851 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1692951234; bh=vFZEnrTAOAQen32IAhYU+bdqfyBr2cM5J/GXiySPy/U=; h=From:Date:Subject:References:In-Reply-To:To:Cc:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=dQe7jpOhKYnq5XmaNNl0sGZQwBz6AngbWV7yZSezQkyPjtxBHWCpoVcbEKOLQevtl i9hx9OcQkBvSgpDXuGvmuAUODYJAb3Ts7+h8n4Ljsj0dFEoadWHzyyvyZpUjMvtc4h BL6pJuaUjVqzELhismAVGaCNjILNaYMSug8Enz3E= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 5A1DEF80074; Fri, 25 Aug 2023 10:12:30 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id CE891F80558; Fri, 25 Aug 2023 10:12:29 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 30AB0F800D1; Fri, 25 Aug 2023 10:12:26 +0200 (CEST) Received: from mail-lf1-x136.google.com (mail-lf1-x136.google.com [IPv6:2a00:1450:4864:20::136]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id F0E7DF800D1 for ; Fri, 25 Aug 2023 10:12:15 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz F0E7DF800D1 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=GS9ZcTGr Received: by mail-lf1-x136.google.com with SMTP id 2adb3069b0e04-500a398cda5so974271e87.0 for ; Fri, 25 Aug 2023 01:12:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692951134; x=1693555934; 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=b+8MTCJJPEn/JGBNuu906jziHv3DlZsxUiatrimUoug=; b=GS9ZcTGr6eW5+Zq7vkkbvhEcpibZWQ4bE8pmXv4GoGIVZVtumdBnWg3aaSsIlpd8eZ OA8Dg6oHck9ZZK5gmQMipqBzNJtD7P6+127+CsUg0/KukeUbnDju+XvY9VTPWNiHfiHr 3Awf4WQHKw1q7nl4tEfdW2APtKyhMOFJOT3NRGM9FZvZp7pM4oYqPnR5halDlgk0CGy8 hHuZclux4yLY9+xGCR1fxz3SfSWT1/rTB3uNfjAaXaDX7QRQFPbF4b4va3xpM2k6qB+u baIyIWcC9n7gAjFCUrFzW6kHaXOn3lx+bs4EYVZyvU2CU4SRf0esWU+o8/S8qclzL3ID Nd2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692951134; x=1693555934; 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=b+8MTCJJPEn/JGBNuu906jziHv3DlZsxUiatrimUoug=; b=Vk2fR95FOeu89vw9tIfPZuaC/TA/oCzikBsZIhmw6nWJLNZR96o24D7vxxvSOK43iY z+fnOS8yHILiDEFHpJg67Jnqr8xsZWrxuJFI+6pPQKBpCcXQwMbB3a7IUhYTZaeMhdQn 2pNqW9GsLRyCYhZl5dwDlsLQnS7FlR4bHW+AceqPrNWdFHXkvHfMisYSEeP7hUdQ3ALG Hk8UsI/jihOIqlkcnUgVV7WoAZ6CxscPRfoG8JCu/Q68S5nEwfYRgK0oAZQHbA8vPBcj tVjgEndxWhJ/EpwEbn+2xas4bnIvv2VEVnpoPJ5MvJ7ZhiQjYY3LLsoJIoo7JxesXXF/ SsPw== X-Gm-Message-State: AOJu0YwgRuuz8l6mxGOG8uxNWvGPQKuDd0BMnrq8MnlocSYglwzAYKZY Ihx/17RMTS5KNlbYds0DzMMjnw== X-Google-Smtp-Source: AGHT+IFmnMm6qB463AlxIIOwocgb6x+Snv48XGIBxuceoO10VWRQRMRDhQd7hZBHJLCafnv2DouLkA== X-Received: by 2002:a05:6512:33c6:b0:4f8:631b:bf77 with SMTP id d6-20020a05651233c600b004f8631bbf77mr14929337lfg.22.1692951134067; Fri, 25 Aug 2023 01:12:14 -0700 (PDT) Received: from [127.0.1.1] ([85.235.12.238]) by smtp.gmail.com with ESMTPSA id q28-20020ac2511c000000b004fe1a35fd15sm195559lfb.140.2023.08.25.01.12.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Aug 2023 01:12:13 -0700 (PDT) From: Linus Walleij Date: Fri, 25 Aug 2023 10:12:11 +0200 Subject: [PATCH 1/7] ASoC: max9768: Convert to use GPIO descriptors MIME-Version: 1.0 Message-Id: <20230825-descriptors-asoc-max-v1-1-b212292b2f08@linaro.org> References: <20230825-descriptors-asoc-max-v1-0-b212292b2f08@linaro.org> In-Reply-To: <20230825-descriptors-asoc-max-v1-0-b212292b2f08@linaro.org> To: Jaroslav Kysela , Takashi Iwai , Liam Girdwood , Mark Brown Cc: alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Linus Walleij X-Mailer: b4 0.12.3 Message-ID-Hash: Z3FTYSVCY3GCZ7DSAMEPRSLCVWCFANVZ X-Message-ID-Hash: Z3FTYSVCY3GCZ7DSAMEPRSLCVWCFANVZ X-MailFrom: linus.walleij@linaro.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: The MAX9768 is pretty straight forward to convert to GPIO descriptors. To name the GPIO properties, I looke at the bindings in maxim,max9759.yaml which names these GPIO "mute" and "shutdown" respectively. No board files using platform data exist in the kernel, new users can use GPIO descriptor tables if desired. Signed-off-by: Linus Walleij --- include/sound/max9768.h | 4 ---- sound/soc/codecs/max9768.c | 45 +++++++++++++++++++++++---------------------- 2 files changed, 23 insertions(+), 26 deletions(-) diff --git a/include/sound/max9768.h b/include/sound/max9768.h index 0f78b41d030e..8509ba0079b0 100644 --- a/include/sound/max9768.h +++ b/include/sound/max9768.h @@ -9,14 +9,10 @@ /** * struct max9768_pdata - optional platform specific MAX9768 configuration - * @shdn_gpio: GPIO to SHDN pin. If not valid, pin must be hardwired HIGH - * @mute_gpio: GPIO to MUTE pin. If not valid, control for mute won't be added * @flags: configuration flags, e.g. set classic PWM mode (check datasheet * regarding "filterless modulation" which is default). */ struct max9768_pdata { - int shdn_gpio; - int mute_gpio; unsigned flags; #define MAX9768_FLAG_CLASSIC_PWM (1 << 0) }; diff --git a/sound/soc/codecs/max9768.c b/sound/soc/codecs/max9768.c index d22b4ba51ed8..8d0ca1be99c0 100644 --- a/sound/soc/codecs/max9768.c +++ b/sound/soc/codecs/max9768.c @@ -9,7 +9,7 @@ #include #include #include -#include +#include #include #include @@ -27,8 +27,8 @@ struct max9768 { struct regmap *regmap; - int mute_gpio; - int shdn_gpio; + struct gpio_desc *mute; + struct gpio_desc *shdn; u32 flags; }; @@ -42,7 +42,7 @@ static int max9768_get_gpio(struct snd_kcontrol *kcontrol, { struct snd_soc_component *c = snd_soc_kcontrol_component(kcontrol); struct max9768 *max9768 = snd_soc_component_get_drvdata(c); - int val = gpio_get_value_cansleep(max9768->mute_gpio); + int val = gpiod_get_value_cansleep(max9768->mute); ucontrol->value.integer.value[0] = !val; @@ -55,7 +55,7 @@ static int max9768_set_gpio(struct snd_kcontrol *kcontrol, struct snd_soc_component *c = snd_soc_kcontrol_component(kcontrol); struct max9768 *max9768 = snd_soc_component_get_drvdata(c); - gpio_set_value_cansleep(max9768->mute_gpio, !ucontrol->value.integer.value[0]); + gpiod_set_value_cansleep(max9768->mute, !ucontrol->value.integer.value[0]); return 0; } @@ -138,7 +138,7 @@ static int max9768_probe(struct snd_soc_component *component) return ret; } - if (gpio_is_valid(max9768->mute_gpio)) { + if (max9768->mute) { ret = snd_soc_add_component_controls(component, max9768_mute, ARRAY_SIZE(max9768_mute)); if (ret) @@ -171,28 +171,29 @@ static int max9768_i2c_probe(struct i2c_client *client) { struct max9768 *max9768; struct max9768_pdata *pdata = client->dev.platform_data; - int err; max9768 = devm_kzalloc(&client->dev, sizeof(*max9768), GFP_KERNEL); if (!max9768) return -ENOMEM; - if (pdata) { - /* Mute on powerup to avoid clicks */ - err = devm_gpio_request_one(&client->dev, pdata->mute_gpio, - GPIOF_INIT_HIGH, "MAX9768 Mute"); - max9768->mute_gpio = err ?: pdata->mute_gpio; - - /* Activate chip by releasing shutdown, enables I2C */ - err = devm_gpio_request_one(&client->dev, pdata->shdn_gpio, - GPIOF_INIT_HIGH, "MAX9768 Shutdown"); - max9768->shdn_gpio = err ?: pdata->shdn_gpio; - + /* Mute on powerup to avoid clicks */ + max9768->mute = devm_gpiod_get_optional(&client->dev, + "mute", + GPIOD_OUT_HIGH); + if (IS_ERR(max9768->mute)) + return PTR_ERR(max9768->mute); + gpiod_set_consumer_name(max9768->mute, "MAX9768 Mute"); + + /* Activate chip by releasing shutdown, enables I2C */ + max9768->shdn = devm_gpiod_get_optional(&client->dev, + "shutdown", + GPIOD_OUT_HIGH); + if (IS_ERR(max9768->shdn)) + return PTR_ERR(max9768->shdn); + gpiod_set_consumer_name(max9768->shdn, "MAX9768 Shutdown"); + + if (pdata) max9768->flags = pdata->flags; - } else { - max9768->shdn_gpio = -EINVAL; - max9768->mute_gpio = -EINVAL; - } i2c_set_clientdata(client, max9768); From patchwork Fri Aug 25 08:12:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 716897 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 447AFC3DA66 for ; Fri, 25 Aug 2023 08:14:36 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 5960D1E3; Fri, 25 Aug 2023 10:13:44 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 5960D1E3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1692951274; bh=ZPOVoWflkn5ze/RL1vfcrWv4KndgatLnq+lpS515m1M=; h=From:Date:Subject:References:In-Reply-To:To:Cc:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=onY12nRVoHiLCFWEr1boywbHJKI3XPq2Ti3h1TcP2Y+uG4Z2tvslpLxrTKjhqW8xD BWeQdotgFfFW83iyq8g3jq4wpQGZzM9fPwdX6242zjGyo5KV2IOdvzH0C22xqimCCI N7ahEO1EmKzU/JeB64N5siOzcEoRzX7GPNPUwHCw= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 0E855F8056F; Fri, 25 Aug 2023 10:12:36 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 17EF3F80579; Fri, 25 Aug 2023 10:12:36 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 2A61DF8055C; Fri, 25 Aug 2023 10:12:30 +0200 (CEST) Received: from mail-lf1-x12b.google.com (mail-lf1-x12b.google.com [IPv6:2a00:1450:4864:20::12b]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id AC363F800F5 for ; Fri, 25 Aug 2023 10:12:17 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz AC363F800F5 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=ZXicqbRu Received: by mail-lf1-x12b.google.com with SMTP id 2adb3069b0e04-5007abb15e9so963760e87.0 for ; Fri, 25 Aug 2023 01:12:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692951135; x=1693555935; 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=NBbRRSYAQA5xmq25ubQ8kHHlKCIWtZeRLr/sb85xuNU=; b=ZXicqbRubMjwCeZSDp32zGvSe2Cg8/FKjVonc3OsBRO2krXO9cvadTN+LEo+huL3zn OIhuzcmuZ3+DNGfyUWUCnuHFZT6ri6Nm07495TVslpIaSQ+NwKVr6zekLYT0PZSblQrs wagBfLfbz5NQpkh7nX06Io3lM54ZJt2f6MhCztCKdKx86JpxnpZlXLGy1+BQ1Im+EdaN AGZG/AsNNs0dYj56gsC/jkl6aRqlgLHWJ1hpp1h+Mfw6U8oU3wtq7mCeGrhqhOULtwHX 1BxTwnLpJ71GxdGgkFs12MOHXaxOu6FTOzDbnJZI20sPRMcQu5+jN9t8fL8hzsj5adyJ pXTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692951135; x=1693555935; 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=NBbRRSYAQA5xmq25ubQ8kHHlKCIWtZeRLr/sb85xuNU=; b=T47fWjilBVdH/VNdKUI9O85Q923sdN1q9e4mUXNoIBFx5usx3PqCB2kL7S1z/keWgd rOLhw6DdI/DjqNGTwDRCJ//6X12oKFcxedM22lGxFVMkJZ/0QuGSfz0cfq0/72Ljl1TZ IxScAwzjCp+JZyeW3XadpKeDX/we0luCKVCASZxk9+bfOFFMAh3Qlz8CHyqJ7jmcIReL iAbGJ111H+gLeIwerGt7y4oIsNgJslLR5WoFrHwuRWE1gZIv91fYeFNMz4+pps0nl3r3 og7yxqxfYu4+Wh24zta+MoHmLZ6EZMtbY/n7+captunA4rz66X3LQTBwQfAiWqKyJC4r Gccg== X-Gm-Message-State: AOJu0YwBiYLT+4YYcenGsnFQcYPB+psNvKc/CVc/9x/+JbekfG80XkPu 4+EZ0IEtq8+eNAlMDbcAr/oGNA== X-Google-Smtp-Source: AGHT+IEPLIDpD1w1RF98YcjynCIXKHZQox8F22rws/cF0RMIh/cKJbjBBRiwjVgcU5sTSiS7K0f0rA== X-Received: by 2002:a05:6512:615:b0:4fd:c923:db59 with SMTP id b21-20020a056512061500b004fdc923db59mr11392637lfe.15.1692951135669; Fri, 25 Aug 2023 01:12:15 -0700 (PDT) Received: from [127.0.1.1] ([85.235.12.238]) by smtp.gmail.com with ESMTPSA id q28-20020ac2511c000000b004fe1a35fd15sm195559lfb.140.2023.08.25.01.12.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Aug 2023 01:12:15 -0700 (PDT) From: Linus Walleij Date: Fri, 25 Aug 2023 10:12:13 +0200 Subject: [PATCH 3/7] ASoC: max98373: Convert to use GPIO descriptors MIME-Version: 1.0 Message-Id: <20230825-descriptors-asoc-max-v1-3-b212292b2f08@linaro.org> References: <20230825-descriptors-asoc-max-v1-0-b212292b2f08@linaro.org> In-Reply-To: <20230825-descriptors-asoc-max-v1-0-b212292b2f08@linaro.org> To: Jaroslav Kysela , Takashi Iwai , Liam Girdwood , Mark Brown Cc: alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Linus Walleij X-Mailer: b4 0.12.3 Message-ID-Hash: RTWVNJ5GMUDYOJPMKVV3NEPTTKJTKNY4 X-Message-ID-Hash: RTWVNJ5GMUDYOJPMKVV3NEPTTKJTKNY4 X-MailFrom: linus.walleij@linaro.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Instead of relying on legacy interfaces, convert the driver to use GPIO descriptors. This is a straight-forward conversion, we support also sdw devices providing GPIO descriptor tables if they so desire. Signed-off-by: Linus Walleij --- sound/soc/codecs/max98373-i2c.c | 17 ----------------- sound/soc/codecs/max98373.c | 35 +++++++++++++++++++---------------- sound/soc/codecs/max98373.h | 2 +- 3 files changed, 20 insertions(+), 34 deletions(-) diff --git a/sound/soc/codecs/max98373-i2c.c b/sound/soc/codecs/max98373-i2c.c index 0fa5ceca62a2..e7ec7875c4a9 100644 --- a/sound/soc/codecs/max98373-i2c.c +++ b/sound/soc/codecs/max98373-i2c.c @@ -3,12 +3,10 @@ #include #include -#include #include #include #include #include -#include #include #include #include @@ -560,21 +558,6 @@ static int max98373_i2c_probe(struct i2c_client *i2c) /* voltage/current slot & gpio configuration */ max98373_slot_config(&i2c->dev, max98373); - /* Power on device */ - if (gpio_is_valid(max98373->reset_gpio)) { - ret = devm_gpio_request(&i2c->dev, max98373->reset_gpio, - "MAX98373_RESET"); - if (ret) { - dev_err(&i2c->dev, "%s: Failed to request gpio %d\n", - __func__, max98373->reset_gpio); - return -EINVAL; - } - gpio_direction_output(max98373->reset_gpio, 0); - msleep(50); - gpio_direction_output(max98373->reset_gpio, 1); - msleep(20); - } - /* Check Revision ID */ ret = regmap_read(max98373->regmap, MAX98373_R21FF_REV_ID, ®); diff --git a/sound/soc/codecs/max98373.c b/sound/soc/codecs/max98373.c index fde055c6c894..33eb4576da23 100644 --- a/sound/soc/codecs/max98373.c +++ b/sound/soc/codecs/max98373.c @@ -12,9 +12,8 @@ #include #include #include -#include +#include #include -#include #include #include "max98373.h" @@ -478,20 +477,24 @@ void max98373_slot_config(struct device *dev, max98373->i_slot = value & 0xF; else max98373->i_slot = 1; - if (dev->of_node) { - max98373->reset_gpio = of_get_named_gpio(dev->of_node, - "maxim,reset-gpio", 0); - if (!gpio_is_valid(max98373->reset_gpio)) { - dev_err(dev, "Looking up %s property in node %s failed %d\n", - "maxim,reset-gpio", dev->of_node->full_name, - max98373->reset_gpio); - } else { - dev_dbg(dev, "maxim,reset-gpio=%d", - max98373->reset_gpio); - } - } else { - /* this makes reset_gpio as invalid */ - max98373->reset_gpio = -1; + + /* This will assert RESET */ + max98373->reset = devm_gpiod_get_optional(dev, + "maxim,reset", + GPIOD_OUT_HIGH); + if (IS_ERR(max98373->reset)) { + dev_err(dev, "error %ld looking up RESET GPIO line\n", + PTR_ERR(max98373->reset)); + return; + } + + /* Cycle reset */ + if (max98373->reset) { + gpiod_set_consumer_name(max98373->reset ,"MAX98373_RESET"); + gpiod_direction_output(max98373->reset, 1); + msleep(50); + gpiod_direction_output(max98373->reset, 0); + msleep(20); } if (!device_property_read_u32(dev, "maxim,spkfb-slot-no", &value)) diff --git a/sound/soc/codecs/max98373.h b/sound/soc/codecs/max98373.h index e1810b3b1620..af3b62217497 100644 --- a/sound/soc/codecs/max98373.h +++ b/sound/soc/codecs/max98373.h @@ -213,7 +213,7 @@ struct max98373_cache { struct max98373_priv { struct regmap *regmap; - int reset_gpio; + struct gpio_desc *reset; unsigned int v_slot; unsigned int i_slot; unsigned int spkfb_slot; From patchwork Fri Aug 25 08:12:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 716896 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 080AEC3DA66 for ; Fri, 25 Aug 2023 08:15:05 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 104C0DF6; Fri, 25 Aug 2023 10:14:13 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 104C0DF6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1692951303; bh=ajLjAoKS5LYhzLyFaGqTcrQB5QlpO9TiPVOmXYFaxHc=; h=From:Date:Subject:References:In-Reply-To:To:Cc:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=OnizLNWSK9mOcDtS8vxRK2FKAs+OtK/QfaBnlI9C8Zn2szdcpPPLmJZz7J4vXVzUZ UxEzBFCBeA3Uq9jA/lxlQOlxNy8/XbZmv2/+WIFfwvPw6ueZuepP2h4JuoFjR0R/oB ucV04vbrcHYzomZjbg1JgSCNfNhI0f0xtLiFDmts= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 52448F805AF; Fri, 25 Aug 2023 10:12:41 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 9C837F805B2; Fri, 25 Aug 2023 10:12:40 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 9B74DF80567; Fri, 25 Aug 2023 10:12:31 +0200 (CEST) Received: from mail-lf1-x12b.google.com (mail-lf1-x12b.google.com [IPv6:2a00:1450:4864:20::12b]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id D850AF8022B for ; Fri, 25 Aug 2023 10:12:17 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz D850AF8022B Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=YYmfBumd Received: by mail-lf1-x12b.google.com with SMTP id 2adb3069b0e04-4fe27849e6aso927773e87.1 for ; Fri, 25 Aug 2023 01:12:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692951136; x=1693555936; 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=nZvQIqiJILx7Vu44bdAP6xXOlwSKHGpCyi7z1wxsqaw=; b=YYmfBumd1OqmN1kcJfKuQGJb+t6phEs/bHy0wzfEWEPqcBhHzQFEh7HWO5r7zI3KzK rlE/o9gkuU4tb4GOeW4HKbUsN4tkJmcv9YMo41BmkTy+9R1GtaXSAsW3wVlwpfWsEaQj 8pklm/io7r+91riwH1xb5DOgZnUTBIZ0vR8JR1x2dqCZS97VqmBV8Ur1otWfoIshvjrz LkVGMccfYQkq52qo+UQfxt4+1PtThFLeIEJhJmU3qzaD2IjQ7a7EB360vPqny0hrF3W0 /mVzGnGBe1gq8JM9tvtCVn/0J5kT2aFW1S95QT0J17Uq8WsOaG7xNMP2r1qD5UbtS/5r Sk7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692951136; x=1693555936; 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=nZvQIqiJILx7Vu44bdAP6xXOlwSKHGpCyi7z1wxsqaw=; b=NVBOFJGUcV1wgybNHmJzO2mfrywTFGyYGy1uKaJOvtBKayZV+aCWpaZdqqkEN6RXj5 QKSZr7dVY76X61o0a5+qFEAosrmcIemiFMMJKpTOrUr3i24qelI15Kkae5FG59TnjAJU tlde51wukwJC9WbDVZGKpWX2piBnEdDZ3YAHUPUyITckZPk3xkjsmD32iIzw3NGMvy+I 4fUQ3yFO1pXtBwgdUKb4OKjJhyDDUSG1J80qihQ2UxPhD+lGWwk7vM77xHuJ2rbHPOQH /4ljwpjHrFORngZxsPxOcxzCkelEs1gAW5GJ8aZQJ3zybDAkW6zPNMrOVqUhKGWKfbfG DiDw== X-Gm-Message-State: AOJu0YxA568r88s3ffgkQpc12HDZy7ZN5Fn3mPh46CVAOXxNS58UGJ3i hwMSlRHi9c6zaJdraPF5WiUpjg== X-Google-Smtp-Source: AGHT+IG2PpNK4ugGGs+dTr6KbXE8uHau4dcclyQjik08hXAm1AW/KDfAXQLnuJhnsM+8CSpY83s9Ig== X-Received: by 2002:a05:6512:32a9:b0:500:a6c1:36f7 with SMTP id q9-20020a05651232a900b00500a6c136f7mr1030311lfe.3.1692951136501; Fri, 25 Aug 2023 01:12:16 -0700 (PDT) Received: from [127.0.1.1] ([85.235.12.238]) by smtp.gmail.com with ESMTPSA id q28-20020ac2511c000000b004fe1a35fd15sm195559lfb.140.2023.08.25.01.12.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Aug 2023 01:12:16 -0700 (PDT) From: Linus Walleij Date: Fri, 25 Aug 2023 10:12:14 +0200 Subject: [PATCH 4/7] ASoC: max98388: Correct the includes MIME-Version: 1.0 Message-Id: <20230825-descriptors-asoc-max-v1-4-b212292b2f08@linaro.org> References: <20230825-descriptors-asoc-max-v1-0-b212292b2f08@linaro.org> In-Reply-To: <20230825-descriptors-asoc-max-v1-0-b212292b2f08@linaro.org> To: Jaroslav Kysela , Takashi Iwai , Liam Girdwood , Mark Brown Cc: alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Linus Walleij X-Mailer: b4 0.12.3 Message-ID-Hash: M6BL52M4TPIXKHWVAFQYYJZRFBM2BAZK X-Message-ID-Hash: M6BL52M4TPIXKHWVAFQYYJZRFBM2BAZK X-MailFrom: linus.walleij@linaro.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: The MAX98388 driver is using the modern GPIO descriptor API but uses legacy includes. Include the proper header instead. Signed-off-by: Linus Walleij --- sound/soc/codecs/max98388.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sound/soc/codecs/max98388.c b/sound/soc/codecs/max98388.c index cde5e85946cb..078adec29312 100644 --- a/sound/soc/codecs/max98388.c +++ b/sound/soc/codecs/max98388.c @@ -3,12 +3,11 @@ #include #include -#include +#include #include #include #include #include -#include #include #include #include From patchwork Fri Aug 25 08:12:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 716895 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 899A5C3DA6F for ; Fri, 25 Aug 2023 08:15:39 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id BE11CDF4; Fri, 25 Aug 2023 10:14:47 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz BE11CDF4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1692951337; bh=FSlYlj1KG0nji8kkC1b1nGClknPc1v0yc/Fc3a1Sl20=; h=From:Date:Subject:References:In-Reply-To:To:Cc:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=L7Kw6wOyJd6FzKBv0c0fR8S6pMNaqS5/vTTxL2GLU2P19DaXcaDuoa4T6pqr1YY9z 8VjjMmAC6rHr71EElBg3dxKlApiSuiyVqd1mgf+kVfJUOob7TNh4//gHPCnUe8qpAl NkcfR1CtR6zcuL1W4APd3GUDOgZKD2n0/vdAClH0= Received: by alsa1.perex.cz (Postfix, from userid 50401) id A1AB5F805D4; Fri, 25 Aug 2023 10:12:45 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id E6370F805C7; Fri, 25 Aug 2023 10:12:44 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id EFDE2F8023B; Fri, 25 Aug 2023 10:12:33 +0200 (CEST) Received: from mail-lf1-x136.google.com (mail-lf1-x136.google.com [IPv6:2a00:1450:4864:20::136]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 72B32F80158 for ; Fri, 25 Aug 2023 10:12:20 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 72B32F80158 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=N8tOQE1+ Received: by mail-lf1-x136.google.com with SMTP id 2adb3069b0e04-5009d4a4897so959043e87.0 for ; Fri, 25 Aug 2023 01:12:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692951139; x=1693555939; 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=RoFqFLIfT/Pj/zYgo2TV8TIm3I2iaBuNZRSIlIfashI=; b=N8tOQE1+ggrtynhDr3biXEZNw1zz5cY70hzKKCVyFf+IMR1yXAXthVrO/VesE5LNY6 ZFTe+aebePO3TMPyUdOZVEzyfSEQc3DteeWzMyV2gwsGhB8kOMWjjZYb6Wf5JEfx1+lz 8TsDpUMI2g2nGjoUR29rC0agQh6w0db6a1QcHGvJg887QaBWx2t8czqalAywY0CXoOwg 40YCYGtu37bDDcAr4YtLIVR4Jy5MjaA0st0MTxF+h46IeoWNobjmX37+IvsTNDHZ9mjk M9aHhdvbtyHYBSZ+6mVz7bXGNAl4LlIbJ/3sigo6Emyc+iCyMEDtEpqqG2rHBisr8V3F 5fFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692951139; x=1693555939; 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=RoFqFLIfT/Pj/zYgo2TV8TIm3I2iaBuNZRSIlIfashI=; b=Z/ItYUnlPwczz2dFk4+3RCEXIb8zVhZzxex1XDT826W8UJ87DO2pzIvSbX7QfO+UBc enGm60MBnN3hRZU5Vpw955OSLLfuuMI1AkIU/l/49Co1YvIHVaNB0cwbo0e2w0xx4+ck suSgHn+iaRDy46fMwNyvH4cmk/a946Brlm5NJ6FjKqPNV3J093S6BrV5J+8xUUwnNLr2 bH6S4VRLjudwUFMvVK/K7UtIC1tklk3ygc3Y/d70UOHdntwhJWbbFWc7tcOYG8XHcuXs zqwTv3OB3gf7Tr2llbmakm9i5VN5+Btq654fKQF3fcQL16s1FjjyjD671dTksb3FRQuQ KabQ== X-Gm-Message-State: AOJu0YyKk1C7uPJJmNpyYuEBzCHiXTZhydhV2lRdh1VpWyskmqpcGQ8q iqIpWsOiW8WC6swgHfW1vGCnQg== X-Google-Smtp-Source: AGHT+IEjrTALuwMVuRJO/f49NCeBOByJE1JiQEqP9VZfv9t+k1WQ0Gs+avCqvnzSr9p3zL8bSAc/pA== X-Received: by 2002:a05:6512:3450:b0:4fb:99d9:6ba2 with SMTP id j16-20020a056512345000b004fb99d96ba2mr10022257lfr.24.1692951139010; Fri, 25 Aug 2023 01:12:19 -0700 (PDT) Received: from [127.0.1.1] ([85.235.12.238]) by smtp.gmail.com with ESMTPSA id q28-20020ac2511c000000b004fe1a35fd15sm195559lfb.140.2023.08.25.01.12.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Aug 2023 01:12:18 -0700 (PDT) From: Linus Walleij Date: Fri, 25 Aug 2023 10:12:17 +0200 Subject: [PATCH 7/7] ASoC: max98927: Drop pointless includes MIME-Version: 1.0 Message-Id: <20230825-descriptors-asoc-max-v1-7-b212292b2f08@linaro.org> References: <20230825-descriptors-asoc-max-v1-0-b212292b2f08@linaro.org> In-Reply-To: <20230825-descriptors-asoc-max-v1-0-b212292b2f08@linaro.org> To: Jaroslav Kysela , Takashi Iwai , Liam Girdwood , Mark Brown Cc: alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Linus Walleij X-Mailer: b4 0.12.3 Message-ID-Hash: K6NI3PNSBJCIRUH7J5YK7CTRA2PEBPXI X-Message-ID-Hash: K6NI3PNSBJCIRUH7J5YK7CTRA2PEBPXI X-MailFrom: linus.walleij@linaro.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: <> List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: This driver is already using solely GPIO descriptors and do not need to include the legacy headers or . Drop them. Signed-off-by: Linus Walleij --- sound/soc/codecs/max98927.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/sound/soc/codecs/max98927.c b/sound/soc/codecs/max98927.c index 776f23d38ac5..70db9d3ff5a5 100644 --- a/sound/soc/codecs/max98927.c +++ b/sound/soc/codecs/max98927.c @@ -15,9 +15,7 @@ #include #include #include -#include #include -#include #include #include "max98927.h"