From patchwork Wed Nov 16 05:38:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 13044412 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 08AA4C433FE for ; Wed, 16 Nov 2022 05:39:49 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 225C3169C; Wed, 16 Nov 2022 06:38:58 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 225C3169C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1668577188; bh=HOfoUa8mmyOLcGaSybg/Fd+zXx1Ib4yfW5qxsmd31Js=; h=From:To:Subject:Date:Cc:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From; b=qG0ivGaC0i/lS/FcLmLWMbP801kf7ZzJQ5PQHezKouGiwA0pKEoFbHk7Vf6fiuQFe oN/hMVntVmc6dq0icpcxPKHxZ+ACKowHXAmF/Ogu0wKTEQLmKGVUsT3p0sjZ9xtl2i 7JZkMcdIoSvNQnu+/RlwEQ8VWu/SsVhIee7RHpqQ= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 59191F80558; Wed, 16 Nov 2022 06:38:38 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 5D5DDF800B8; Wed, 16 Nov 2022 06:38:34 +0100 (CET) Received: from mail-pj1-x1033.google.com (mail-pj1-x1033.google.com [IPv6:2607:f8b0:4864:20::1033]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id BBD2DF800B8 for ; Wed, 16 Nov 2022 06:38:24 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz BBD2DF800B8 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="O9LU0JS8" Received: by mail-pj1-x1033.google.com with SMTP id gw22so15564702pjb.3 for ; Tue, 15 Nov 2022 21:38:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=Mv8IbBpLkdekGE7AGRon9TYjB5CPxoZZsopxc+3pauE=; b=O9LU0JS8vCLzMrJ6zb77qaHvNYgKNqhBG+WIauQj6WG9zYSAm6dnNrs0cHutUfSh9x qzRtZnolhIfOD+aFB7tYYIJZzjAkg8T7aYSZSpFTkBuWQG0ftQo7X/u4gN23aJKyjsIk Po6VVr4pFEZ722hTx+CNArXH84MNDnnCV9NHuBQpViFkLpX1/ZCvHZ/0krO/pLf9mbBv eG6qWg0hFRbrUljZ5nCIsdTCogtWg7nNsdtLQO8bfyvccDmgj4FUb1eRWUnARowRsUZg I66K77RF09CTR7/VgRQxIV2EiBtxZY7yNtd1hqSIWWHYi+5vb392Dk95uyVYJLY3kRqs 8SVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Mv8IbBpLkdekGE7AGRon9TYjB5CPxoZZsopxc+3pauE=; b=hIRdLfl80G9TI0WpEXx2ni32XmqdyEAoHNZpoUkRlYXwA/A1/KwirG9vKQ6LF/AvNb sypGt1eiO1q/S91mda+THoCVuE3CPV+QLJJyAZkkJUbkRlTFhmAxm2zlaLXWJX46Yx27 JEBYxYCqNC4GOponXlVeBmqCMBLkYT4R/X7yhOwipJl/uixx1cb2UhGZA26pWkqggSRn Z21iR+Rp8hb2/vl0nEGgn+geH2b/jEHSW9sRzjLO+0ZKHB9luG5fEHCJkqwlUU/ODSmJ DV/8W6pa36FwsmYg+E7UjznNDXc1UUY+W1OxIlgHDkWVwfXScwhuTZNrzOShaYi24+6I 6Wbw== X-Gm-Message-State: ANoB5pmbewN6R/54tso7wbX3R4RicTtAnLeY5bNYKTZCeG+sBYI2wvij TwGRAUndB16rED53myIk6+M= X-Google-Smtp-Source: AA0mqf7WoMoXlq9y8GdxWgoMyn/khFjjuSj+m8WTDJSLDonfOrPV3r49GVlLtLExyuhQWHMJ69EHvA== X-Received: by 2002:a17:90a:7e87:b0:212:f810:a846 with SMTP id j7-20020a17090a7e8700b00212f810a846mr2131715pjl.71.1668577101886; Tue, 15 Nov 2022 21:38:21 -0800 (PST) Received: from dtor-ws.mtv.corp.google.com ([2620:15c:9d:2:2d36:e9a0:170b:669f]) by smtp.gmail.com with ESMTPSA id ik13-20020a170902ab0d00b0017834a6966csm10881038plb.176.2022.11.15.21.38.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Nov 2022 21:38:21 -0800 (PST) From: Dmitry Torokhov To: Mark Brown , Liam Girdwood Subject: [PATCH 01/11] ASoC: ak5386: switch to using gpiod API Date: Tue, 15 Nov 2022 21:38:07 -0800 Message-Id: <20221116053817.2929810-1-dmitry.torokhov@gmail.com> X-Mailer: git-send-email 2.38.1.431.g37b22c650d-goog MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" Switch the driver from legacy gpio API that is deprecated to the newer gpiod API that respects line polarities described in ACPI/DT. Signed-off-by: Dmitry Torokhov --- sound/soc/codecs/ak5386.c | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/sound/soc/codecs/ak5386.c b/sound/soc/codecs/ak5386.c index 0c5e00679c7d..0562890b5dc7 100644 --- a/sound/soc/codecs/ak5386.c +++ b/sound/soc/codecs/ak5386.c @@ -6,11 +6,12 @@ * (c) 2013 Daniel Mack */ + +#include +#include #include #include #include -#include -#include #include #include #include @@ -21,7 +22,7 @@ static const char * const supply_names[] = { }; struct ak5386_priv { - int reset_gpio; + struct gpio_desc *reset_gpio; struct regulator_bulk_data supplies[ARRAY_SIZE(supply_names)]; }; @@ -111,8 +112,8 @@ static int ak5386_hw_params(struct snd_pcm_substream *substream, * the AK5386 in power-down mode (PDN pin = ā€œLā€). */ - if (gpio_is_valid(priv->reset_gpio)) - gpio_set_value(priv->reset_gpio, 1); + if (priv->reset_gpio) + gpiod_set_value(priv->reset_gpio, 0); return 0; } @@ -123,8 +124,8 @@ static int ak5386_hw_free(struct snd_pcm_substream *substream, struct snd_soc_component *component = dai->component; struct ak5386_priv *priv = snd_soc_component_get_drvdata(component); - if (gpio_is_valid(priv->reset_gpio)) - gpio_set_value(priv->reset_gpio, 0); + if (priv->reset_gpio) + gpiod_set_value(priv->reset_gpio, 1); return 0; } @@ -168,7 +169,6 @@ static int ak5386_probe(struct platform_device *pdev) if (!priv) return -ENOMEM; - priv->reset_gpio = -EINVAL; dev_set_drvdata(dev, priv); for (i = 0; i < ARRAY_SIZE(supply_names); i++) @@ -179,15 +179,13 @@ static int ak5386_probe(struct platform_device *pdev) if (ret < 0) return ret; - if (of_match_device(of_match_ptr(ak5386_dt_ids), dev)) - priv->reset_gpio = of_get_named_gpio(dev->of_node, - "reset-gpio", 0); + priv->reset_gpio = devm_gpiod_get_optional(dev, "reset", + GPIOD_OUT_HIGH); + ret = PTR_ERR_OR_ZERO(priv->reset_gpio); + if (ret) + return ret; - if (gpio_is_valid(priv->reset_gpio)) - if (devm_gpio_request_one(dev, priv->reset_gpio, - GPIOF_OUT_INIT_LOW, - "AK5386 Reset")) - priv->reset_gpio = -EINVAL; + gpiod_set_consumer_name(priv->reset_gpio, "AK5386 Reset"); return devm_snd_soc_register_component(dev, &soc_component_ak5386, &ak5386_dai, 1); From patchwork Wed Nov 16 05:38:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 13044411 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 E2AC0C433FE for ; Wed, 16 Nov 2022 05:39:26 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id E991783B; Wed, 16 Nov 2022 06:38:34 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz E991783B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1668577165; bh=tWE87n2V9hDE8IrWLgCLl7RIjkMlfnkXWTRKaqBgy1M=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=s+Cf/TgF0InJViMkQvxNBtEnyVqORieLrovwf1rDkvO+JK5jiB81XZWgE0iSEXzjx nuDVXJyvLKwCyPOzs30jTN9bqpor+h95uBYup7+M+myXsFo2jEF31Gnu533Hu30wCY xOI2yQw1sEe25dLZnjpWBZBuCXElBojDvHGQyLRo= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 4AF91F8032D; Wed, 16 Nov 2022 06:38:34 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id BC1F2F80240; Wed, 16 Nov 2022 06:38:32 +0100 (CET) Received: from mail-pj1-x102e.google.com (mail-pj1-x102e.google.com [IPv6:2607:f8b0:4864:20::102e]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 66E40F800B5 for ; Wed, 16 Nov 2022 06:38:27 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 66E40F800B5 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="b5/F1lcF" Received: by mail-pj1-x102e.google.com with SMTP id c15-20020a17090a1d0f00b0021365864446so1341781pjd.4 for ; Tue, 15 Nov 2022 21:38:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=yEUFbdVypOtyoH064OjwzyJ2ZvEG5EnyjXzOQihafjo=; b=b5/F1lcFrypyG5b3jZd+tIci2jDxqkerWT178BAUcRicXkw95dBFxRknwrsZMS5Qud MlaVJs2wquHY4clWTApR5ZADFFvP/rBfGGjMXoynix7py8419JTe18a4QU3ldzp2e42Q snQtuSlystcc2T7vWhP4LZ5Id/pkAsturPEbM21KtqDB66Q5yrGIVhQE5h0/XF9atu2b /viTKRsIgxeAFGKq2MKvzP3a5zDdh5uIv8BnGJlIt66+NkLlvfgaDCbbJZ3LBxTIGUrx Q4M4eXC+8RU/oLEVmQgsyKM6/CmwkPOoVFpU+cxPL+MfceYAsUS/byeTNadVgiOQVpr9 1OWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=yEUFbdVypOtyoH064OjwzyJ2ZvEG5EnyjXzOQihafjo=; b=CQs8f3TE7m7Dr5N//4RbzP5Rd3UNd7HfvPdpqDxy91bgwtLg5eXolK/C7xCeRPru4o Y9sRk4VBQENBu2eE+hwwjI6ierEayyw5b46Aq629BFiRgVo+JkTim0MG1inJihqPRJq5 UFFWOfj+C/kq0wZbE8VMCI8tPBfR6uF9Ixs848rpMziZKtTZ/mftYwvddzsnazZodyt5 +c8drzQ11XvVcCdi3WHIgQ9dn2qJSOFUPAUkUlsSddj8sgZ1bavQe7crdkwki447NPmN 5wddNREQSRb5nOKC+198lqKuhixCKk9g+NECGbLllnsTgAQ7C1/A/xfCKKLcyLFH55ZJ ZzZw== X-Gm-Message-State: ANoB5pm3h9KuWzplaMaKseIrG1s92MUa5JWdAHW/rZI8KQ11tzcAdn7N mbu/INxm8lKNMLFzCvxYNzA= X-Google-Smtp-Source: AA0mqf5z79P1swqzv8dzeNZZJOFB+xE8MMujTBBZYIu2jV3tvbzH4zWATe4F3ROm4HqVKvHQzeUozw== X-Received: by 2002:a17:902:e846:b0:186:94b8:5980 with SMTP id t6-20020a170902e84600b0018694b85980mr7764409plg.113.1668577103864; Tue, 15 Nov 2022 21:38:23 -0800 (PST) Received: from dtor-ws.mtv.corp.google.com ([2620:15c:9d:2:2d36:e9a0:170b:669f]) by smtp.gmail.com with ESMTPSA id ik13-20020a170902ab0d00b0017834a6966csm10881038plb.176.2022.11.15.21.38.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Nov 2022 21:38:23 -0800 (PST) From: Dmitry Torokhov To: Mark Brown , Liam Girdwood Subject: [PATCH 02/11] ASoC: max98373: switch to using gpiod API Date: Tue, 15 Nov 2022 21:38:08 -0800 Message-Id: <20221116053817.2929810-2-dmitry.torokhov@gmail.com> X-Mailer: git-send-email 2.38.1.431.g37b22c650d-goog In-Reply-To: <20221116053817.2929810-1-dmitry.torokhov@gmail.com> References: <20221116053817.2929810-1-dmitry.torokhov@gmail.com> MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" Switch the driver from legacy gpio API that is deprecated to the newer gpiod API that respects line polarities described in ACPI/DT. Signed-off-by: Dmitry Torokhov --- sound/soc/codecs/max98373-i2c.c | 39 +++++++++++++++++++-------------- sound/soc/codecs/max98373.c | 18 --------------- sound/soc/codecs/max98373.h | 1 - 3 files changed, 22 insertions(+), 36 deletions(-) diff --git a/sound/soc/codecs/max98373-i2c.c b/sound/soc/codecs/max98373-i2c.c index 3e04c7f0cce4..969cdca83bc1 100644 --- a/sound/soc/codecs/max98373-i2c.c +++ b/sound/soc/codecs/max98373-i2c.c @@ -3,12 +3,12 @@ #include #include -#include +#include +#include #include #include #include #include -#include #include #include #include @@ -520,14 +520,13 @@ static int max98373_i2c_probe(struct i2c_client *i2c) int ret = 0; int reg = 0; int i; - struct max98373_priv *max98373 = NULL; + struct max98373_priv *max98373; + struct gpio_desc *reset_gpio; max98373 = devm_kzalloc(&i2c->dev, sizeof(*max98373), GFP_KERNEL); + if (!max98373) + return -ENOMEM; - if (!max98373) { - ret = -ENOMEM; - return ret; - } i2c_set_clientdata(i2c, max98373); /* update interleave mode info */ @@ -557,17 +556,23 @@ static int max98373_i2c_probe(struct i2c_client *i2c) 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); + /* Acquire and assert reset line */ + reset_gpio = devm_gpiod_get_optional(&i2c->dev, "maxim,reset", + GPIOD_OUT_HIGH); + ret = PTR_ERR_OR_ZERO(reset_gpio); + if (ret) { + dev_err(&i2c->dev, "%s: Failed to request reset gpio: %d\n", + __func__, ret); + return ret; + } + + gpiod_set_consumer_name(reset_gpio, "MAX98373_RESET"); + + if (reset_gpio) { + /* Keep line asserted to reset device */ msleep(50); - gpio_direction_output(max98373->reset_gpio, 1); + /* Deassert reset line */ + gpiod_set_value_cansleep(reset_gpio, 0); msleep(20); } diff --git a/sound/soc/codecs/max98373.c b/sound/soc/codecs/max98373.c index f90a6a7ba83b..401546c1084e 100644 --- a/sound/soc/codecs/max98373.c +++ b/sound/soc/codecs/max98373.c @@ -12,9 +12,6 @@ #include #include #include -#include -#include -#include #include #include "max98373.h" @@ -478,21 +475,6 @@ 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; - } if (!device_property_read_u32(dev, "maxim,spkfb-slot-no", &value)) max98373->spkfb_slot = value & 0xF; diff --git a/sound/soc/codecs/max98373.h b/sound/soc/codecs/max98373.h index e1810b3b1620..7b259789e1be 100644 --- a/sound/soc/codecs/max98373.h +++ b/sound/soc/codecs/max98373.h @@ -213,7 +213,6 @@ struct max98373_cache { struct max98373_priv { struct regmap *regmap; - int reset_gpio; unsigned int v_slot; unsigned int i_slot; unsigned int spkfb_slot; From patchwork Wed Nov 16 05:38:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 13044413 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 A63B4C433FE for ; Wed, 16 Nov 2022 05:40:17 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id B2843168D; Wed, 16 Nov 2022 06:39:25 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz B2843168D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1668577215; bh=t8sTlUzRwSX06bk+TSm22kOXJg5XYXa0m8zCkNZAW98=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=OTrt5mhpUBxA/IM4x+6p+PF27nmPMplevpBbjTAPLAfQwE+f8+/gPMoEVF5T0wym/ Nk5RWc1Cf5cwUgQqMAA3MUgdl+F3+Ma5EA6nMvp4XiEEOBtHttCvXlS2okINxq+59z 0qbk71RAhzru5w3YWm9IDePz+a8pv/1p/4Fo4skg= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 563FDF80557; Wed, 16 Nov 2022 06:38:39 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 176EAF804BC; Wed, 16 Nov 2022 06:38:35 +0100 (CET) Received: from mail-pj1-x102c.google.com (mail-pj1-x102c.google.com [IPv6:2607:f8b0:4864:20::102c]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id A0539F80163 for ; Wed, 16 Nov 2022 06:38:29 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz A0539F80163 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="SGFwQZrp" Received: by mail-pj1-x102c.google.com with SMTP id w3-20020a17090a460300b00218524e8877so1875474pjg.1 for ; Tue, 15 Nov 2022 21:38:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=2R6sweEIHhhYpgiaCutH/nTdz9vJpXVC7DNsSKyfy1o=; b=SGFwQZrpZadseImNE1dV7f7/n+GBWyuP1D3KdEwcSYytRYc/wU6ISg2+8huxQTCYpQ +1nw2DD75F461/POGGsS8UpOsQmzz6vdtUGLbgIYDB20G1GEZ7BrqGKq57XtDCoVVvOX 9+TBX7/WD4kbRmZUCPbs6BMMr2f/B7CD+eSsTqWWRrBAAspwygWwOw3jfPMSNNvHj6VQ 9znQgiT8KPVzcMwy7xoTdvAbQydBM15dwl6UdxGq6udjNangnuPM6xAI/vMJBYZPZTBS yj3EnfXjxf4pVRO7HLqlNGkhyjTtHOwiusaCTaqpcbUjSiTLDRNCYImFcBBAAxTLis1D SiZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=2R6sweEIHhhYpgiaCutH/nTdz9vJpXVC7DNsSKyfy1o=; b=brWJBAkARbr/UxwRD7Jdlctdf0vLt7F46ivoDAzkoG0BYj9krMRyWHbCrsFNRa9jSq J7gXyw+nFJLzsHfirXhXMksiRfpRiw5+iVVl5qHzMty5YrJxz4wCSoxcWijCiO9vi53D AZMfmJHCwppoVCFHFknVtEJwxa/crnvOqQxxkADbEvZWjhoWZ4HPy+5GAPX0uX8Dazrh lTxoZGh0HBFi9YeasUZyqoAQEA9+lW+3tNTeu0At1J1Eu/9BXpgl2y7VotETqbla63xf dl1kAKtLBzz5Ltjy4D//7A+2b99FFOqoI5q8BXRDzoXXlHr+KFpO9Zr0gea3jg1xD6b3 gm5w== X-Gm-Message-State: ANoB5pnJ/0wJGpxGCeVj52cYjPZZhUUexGrqZ/S65Jkx7ViD99FtUX5t DFTA/4QXQh+iq0reB2rWdVs= X-Google-Smtp-Source: AA0mqf69nPVB/e/jNzSi6LyOuxv4aaC/+oypv7ZD7k/OeK9pMQrXeF6o1DIcht7/Hh1QXIGXKcWPEQ== X-Received: by 2002:a17:902:b204:b0:186:a2e3:7035 with SMTP id t4-20020a170902b20400b00186a2e37035mr7435171plr.74.1668577105864; Tue, 15 Nov 2022 21:38:25 -0800 (PST) Received: from dtor-ws.mtv.corp.google.com ([2620:15c:9d:2:2d36:e9a0:170b:669f]) by smtp.gmail.com with ESMTPSA id ik13-20020a170902ab0d00b0017834a6966csm10881038plb.176.2022.11.15.21.38.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Nov 2022 21:38:24 -0800 (PST) From: Dmitry Torokhov To: Mark Brown , Liam Girdwood Subject: [PATCH 03/11] ASoC: tas5086: switch to using gpiod API Date: Tue, 15 Nov 2022 21:38:09 -0800 Message-Id: <20221116053817.2929810-3-dmitry.torokhov@gmail.com> X-Mailer: git-send-email 2.38.1.431.g37b22c650d-goog In-Reply-To: <20221116053817.2929810-1-dmitry.torokhov@gmail.com> References: <20221116053817.2929810-1-dmitry.torokhov@gmail.com> MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" Switch the driver from legacy gpio API that is deprecated to the newer gpiod API that respects line polarities described in ACPI/DT. Signed-off-by: Dmitry Torokhov --- sound/soc/codecs/tas5086.c | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/sound/soc/codecs/tas5086.c b/sound/soc/codecs/tas5086.c index 22143cc5afa7..66b22b800e01 100644 --- a/sound/soc/codecs/tas5086.c +++ b/sound/soc/codecs/tas5086.c @@ -24,14 +24,14 @@ #include #include #include -#include +#include +#include #include #include #include #include #include #include -#include #include #include #include @@ -246,7 +246,7 @@ struct tas5086_private { /* Current sample rate for de-emphasis control */ int rate; /* GPIO driving Reset pin, if any */ - int gpio_nreset; + struct gpio_desc *reset_gpio; struct regulator_bulk_data supplies[ARRAY_SIZE(supply_names)]; }; @@ -462,11 +462,11 @@ static int tas5086_mute_stream(struct snd_soc_dai *dai, int mute, int stream) static void tas5086_reset(struct tas5086_private *priv) { - if (gpio_is_valid(priv->gpio_nreset)) { + if (priv->reset_gpio) { /* Reset codec - minimum assertion time is 400ns */ - gpio_direction_output(priv->gpio_nreset, 0); + gpiod_set_value_cansleep(priv->reset_gpio, 1); udelay(1); - gpio_set_value(priv->gpio_nreset, 1); + gpiod_set_value_cansleep(priv->reset_gpio, 0); /* Codec needs ~15ms to wake up */ msleep(15); @@ -867,9 +867,10 @@ static void tas5086_remove(struct snd_soc_component *component) { struct tas5086_private *priv = snd_soc_component_get_drvdata(component); - if (gpio_is_valid(priv->gpio_nreset)) + if (priv->reset_gpio) { /* Set codec to the reset state */ - gpio_set_value(priv->gpio_nreset, 0); + gpiod_set_value_cansleep(priv->reset_gpio, 1); + } regulator_bulk_disable(ARRAY_SIZE(priv->supplies), priv->supplies); }; @@ -914,7 +915,6 @@ static int tas5086_i2c_probe(struct i2c_client *i2c) { struct tas5086_private *priv; struct device *dev = &i2c->dev; - int gpio_nreset = -EINVAL; int i, ret; priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); @@ -940,16 +940,12 @@ static int tas5086_i2c_probe(struct i2c_client *i2c) i2c_set_clientdata(i2c, priv); - if (of_match_device(of_match_ptr(tas5086_dt_ids), dev)) { - struct device_node *of_node = dev->of_node; - gpio_nreset = of_get_named_gpio(of_node, "reset-gpio", 0); - } - - if (gpio_is_valid(gpio_nreset)) - if (devm_gpio_request(dev, gpio_nreset, "TAS5086 Reset")) - gpio_nreset = -EINVAL; + priv->reset_gpio = devm_gpiod_get(dev, "reset", GPIOD_OUT_LOW); + ret = PTR_ERR_OR_ZERO(priv->reset_gpio); + if (ret) + return ret; - priv->gpio_nreset = gpio_nreset; + gpiod_set_consumer_name(priv->reset_gpio, "TAS5086 Reset"); ret = regulator_bulk_enable(ARRAY_SIZE(priv->supplies), priv->supplies); if (ret < 0) { From patchwork Wed Nov 16 05:38:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 13044415 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 8D6D2C4332F for ; Wed, 16 Nov 2022 05:40:38 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id C326216AF; Wed, 16 Nov 2022 06:39:46 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz C326216AF DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1668577236; bh=S+3QMg1zp6RJ4AzIHlEwYbPMHEDZj/gL2wPHOc7O1d0=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=Qkx0zjqNglLfODQ0cUaU77wxCRxiSaOYW3bnejaXAfqkApZVX8QuzUFjBt3BV9vpr /u+097HBnz2kzly5ip3iuafNDWgF9fqwXgnCcB2J+X17CW/DW68gFKCzoff1a290Gw KhWmNUf8UqpcXR/mN5FcWiDVjh4LAfhExOS89mz4= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 16D75F8057A; Wed, 16 Nov 2022 06:38:44 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 86EE9F80571; Wed, 16 Nov 2022 06:38:41 +0100 (CET) Received: from mail-pl1-x632.google.com (mail-pl1-x632.google.com [IPv6:2607:f8b0:4864:20::632]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id A2164F800B5 for ; Wed, 16 Nov 2022 06:38:32 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz A2164F800B5 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="naf7hHO3" Received: by mail-pl1-x632.google.com with SMTP id io19so15441697plb.8 for ; Tue, 15 Nov 2022 21:38:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=sFQW6v1diH1VyW+sL8lBdAoomh7zxMpXfwnkxl/32zA=; b=naf7hHO3UWHjpNpfDT7zWp+/pfz24/zpiVMv5vvpOmtsjD71TdXVOQuWTrXQlGW3DT k6OQyzXbC33xTJ4vWRBVu9j4bmDx6F7NtWWOnhPf1MyyzqTcFrH8M3c7v3m1bpJmKh15 gL9KA6gm3URmDKumwfAsxlyem/35OjO3zoRfYkjUdt1JcHyccj00Eyx9Bi9uSIWdF7ZT +Wr5OWMJKXnCwh7W+QWb/80dPzmO5u+N6SqhYvU0Q3tpeaFNhACn2zodPNtlWRQxqwEk vdXf+yZqTNcpyU304fRnPyvbpukwqcaJt1vFvtUYIM7XdVNYYbPvJ1oGfq6acSrI+9hU 43MQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=sFQW6v1diH1VyW+sL8lBdAoomh7zxMpXfwnkxl/32zA=; b=k8PKe3f8bX5q9ejauv/p3Wae/zXtjV3vdOKKkuhCwHIv0zEzpo1Ymsr5qsU1fnQExF c4Dy0E8o8975RXrhAf4aWFYVi7AMA6Bp3trbf8vV9Z4mn9BrnyzYTLRXoTUIQWnSKgjq qIXGyRMoLL9hfUo/MXnO0T/Jawfug+UoubJGtjSOdjru3XxeOV5GyHJVCSNGkyfH0oGz JfDQ84XsmZ8S+qibxPMXrhTW6ORXW0x1FciDkozcrpif9PtNLzmWY9ZMutP/bvWisffR AXi64ypT2xk1Z3h0gs01UbpGsDPmx73xT51OR2/lsyz/lawbVzcWeYGnaP0n72SuyJq6 gWmg== X-Gm-Message-State: ANoB5pk34KkmHHzEdz9GnnmabxkOKSNlPnXCuK1bY09CGQvz5O1+QDl5 5rRL90PKOb80FQ6qNSPSHUgEl8bC+Xo= X-Google-Smtp-Source: AA0mqf4eBMXcBzdwJ5mtVoL0fxjZ7psKH+U4U0xM8+RXDkiJthcyDXK7qNiV0gPyIWmCuY6dETT4gA== X-Received: by 2002:a17:902:e546:b0:188:4ea8:a685 with SMTP id n6-20020a170902e54600b001884ea8a685mr7509296plf.71.1668577107897; Tue, 15 Nov 2022 21:38:27 -0800 (PST) Received: from dtor-ws.mtv.corp.google.com ([2620:15c:9d:2:2d36:e9a0:170b:669f]) by smtp.gmail.com with ESMTPSA id ik13-20020a170902ab0d00b0017834a6966csm10881038plb.176.2022.11.15.21.38.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Nov 2022 21:38:27 -0800 (PST) From: Dmitry Torokhov To: Mark Brown , Liam Girdwood Subject: [PATCH 04/11] ASoC: tpa6130a2: remove support for platform data Date: Tue, 15 Nov 2022 21:38:10 -0800 Message-Id: <20221116053817.2929810-4-dmitry.torokhov@gmail.com> X-Mailer: git-send-email 2.38.1.431.g37b22c650d-goog In-Reply-To: <20221116053817.2929810-1-dmitry.torokhov@gmail.com> References: <20221116053817.2929810-1-dmitry.torokhov@gmail.com> MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" There are no users of tpa6130a2_platform_data in the mainline kernel, remove it. Signed-off-by: Dmitry Torokhov --- include/sound/tpa6130a2-plat.h | 17 ----------------- sound/soc/codecs/tpa6130a2.c | 18 ++++-------------- 2 files changed, 4 insertions(+), 31 deletions(-) delete mode 100644 include/sound/tpa6130a2-plat.h diff --git a/include/sound/tpa6130a2-plat.h b/include/sound/tpa6130a2-plat.h deleted file mode 100644 index a60930e36e93..000000000000 --- a/include/sound/tpa6130a2-plat.h +++ /dev/null @@ -1,17 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ -/* - * TPA6130A2 driver platform header - * - * Copyright (C) Nokia Corporation - * - * Author: Peter Ujfalusi - */ - -#ifndef TPA6130A2_PLAT_H -#define TPA6130A2_PLAT_H - -struct tpa6130a2_platform_data { - int power_gpio; -}; - -#endif diff --git a/sound/soc/codecs/tpa6130a2.c b/sound/soc/codecs/tpa6130a2.c index 8c00db32996b..5f00bfc32917 100644 --- a/sound/soc/codecs/tpa6130a2.c +++ b/sound/soc/codecs/tpa6130a2.c @@ -14,7 +14,6 @@ #include #include #include -#include #include #include #include @@ -218,16 +217,15 @@ MODULE_DEVICE_TABLE(i2c, tpa6130a2_id); static int tpa6130a2_probe(struct i2c_client *client) { - struct device *dev; + struct device *dev = &client->dev; struct tpa6130a2_data *data; - struct tpa6130a2_platform_data *pdata = client->dev.platform_data; - struct device_node *np = client->dev.of_node; const struct i2c_device_id *id; const char *regulator; unsigned int version; int ret; - dev = &client->dev; + if (!dev->of_node) + return -ENODEV; data = devm_kzalloc(&client->dev, sizeof(*data), GFP_KERNEL); if (!data) @@ -239,15 +237,7 @@ static int tpa6130a2_probe(struct i2c_client *client) if (IS_ERR(data->regmap)) return PTR_ERR(data->regmap); - if (pdata) { - data->power_gpio = pdata->power_gpio; - } else if (np) { - data->power_gpio = of_get_named_gpio(np, "power-gpio", 0); - } else { - dev_err(dev, "Platform data not set\n"); - dump_stack(); - return -ENODEV; - } + data->power_gpio = of_get_named_gpio(dev->of_node, "power-gpio", 0); i2c_set_clientdata(client, data); From patchwork Wed Nov 16 05:38:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 13044414 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 2C98EC433FE for ; Wed, 16 Nov 2022 05:40:23 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 5D5C516A6; Wed, 16 Nov 2022 06:39:31 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 5D5C516A6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1668577221; bh=eEZuANnkil/DzBZgGMvkD9taL7U5fptBZwhesV7REi4=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=pcXDeP/QmLc9ciS1O1+/WB9C1iuCpqwdLMonwgTn3Yu/EBgGb0U+MLydQdn7WdQXY GBGQFpA6vkdhbrKu7efut5Rb1ESDwR/Sm0fiHmFoI/NwaMOwbWamH31i3We/+x82zz sr24AxIxgbaMgwtKFrEnkfQMyx0EoSnjPrdKvbDQ= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 26416F800B5; Wed, 16 Nov 2022 06:38:43 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 55224F80557; Wed, 16 Nov 2022 06:38:38 +0100 (CET) Received: from mail-pj1-x102f.google.com (mail-pj1-x102f.google.com [IPv6:2607:f8b0:4864:20::102f]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 9A469F804A9 for ; Wed, 16 Nov 2022 06:38:33 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 9A469F804A9 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Hdfcb6sJ" Received: by mail-pj1-x102f.google.com with SMTP id o7so15579234pjj.1 for ; Tue, 15 Nov 2022 21:38:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=r01ypcYo+LtD9fhypz7U4KPnsRobXTNuGoo4vyNF/vc=; b=Hdfcb6sJtZK0d4iSfc/c+K5+0PYEPfETP19Nve63ggNiKTbV6nRrj4Vb4GfGLphU77 JL9fPjFGZN+xuLVLnY9F8MtLwtXD10i7AxQh0kdt+xCvJCzv0IxzCLnwB3CiEO0++qQ8 cvbX71x5YS4YX4MOl3W89daY6QxvCAdYtGF2kIJTH8YFYBTDBvWd+yEE59Z1oqf5Mgsu MswmnkG/O1rW5lzeLp9bQUxKADGJ05ftzgyMVFqGQ75+4mK2VU9l4bxqOZ08fz/LaIAO rXeBGl4jU92zG9ChdWwmYbEGZZtcxAdlkg4m7CV+U61qWVVU26rLYvH2PbRXwv+fCFMV dacQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=r01ypcYo+LtD9fhypz7U4KPnsRobXTNuGoo4vyNF/vc=; b=eAUPU6yG91IyQHqtvBxNHfUnavimsNSdLh+2fsKNZlW9vIEEtUMVRo2P3qbTZ2rBNL 06M4/z0Rss855NytFKEkYpuFjumpDgdCsUHgHtBPu2KYfWKvb8WO0kL2+pDWEouUt/rF vNZKJ+r8nt1rLl5033Dg60a1hUsxUp6gV/OdCpahWKGo3RJsg+3egZQsEwqI8B31Tjk9 Wv8lAKm1ncZPJ1NOBA6UO/4IJI99128MS2kbqb0q/QOk3MZSyLTbpWzfOZ4njpRsREqh tSOeNN0tt6LOHz5NnZKvvVAIZdpAGVwkEZQ6IGRXvUL7g+QpJ55UG+zrLOCvDJ/LjCjJ PTFA== X-Gm-Message-State: ANoB5pmn6gMNAK3v7hT/icF49hFeU8Om4mqprncKdZxn1tof3yndTIcX ixBPZzMnntzeb9h+lPDtQN8= X-Google-Smtp-Source: AA0mqf6LzBMQD9KXFyMAhXpG5nVIjWO4CGNYGngv2AR+5vF/Q88oiCVvIcdaMKPNZkqy9cGqtNtfAQ== X-Received: by 2002:a17:903:2789:b0:186:9b19:1dbb with SMTP id jw9-20020a170903278900b001869b191dbbmr7643358plb.59.1668577109573; Tue, 15 Nov 2022 21:38:29 -0800 (PST) Received: from dtor-ws.mtv.corp.google.com ([2620:15c:9d:2:2d36:e9a0:170b:669f]) by smtp.gmail.com with ESMTPSA id ik13-20020a170902ab0d00b0017834a6966csm10881038plb.176.2022.11.15.21.38.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Nov 2022 21:38:28 -0800 (PST) From: Dmitry Torokhov To: Mark Brown , Liam Girdwood Subject: [PATCH 05/11] ASoC: tpa6130a2: switch to using gpiod API Date: Tue, 15 Nov 2022 21:38:11 -0800 Message-Id: <20221116053817.2929810-5-dmitry.torokhov@gmail.com> X-Mailer: git-send-email 2.38.1.431.g37b22c650d-goog In-Reply-To: <20221116053817.2929810-1-dmitry.torokhov@gmail.com> References: <20221116053817.2929810-1-dmitry.torokhov@gmail.com> MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" Switch the driver from legacy gpio API that is deprecated to the newer gpiod API that respects line polarities described in ACPI/DT. Signed-off-by: Dmitry Torokhov --- sound/soc/codecs/tpa6130a2.c | 42 +++++++++++++++--------------------- 1 file changed, 17 insertions(+), 25 deletions(-) diff --git a/sound/soc/codecs/tpa6130a2.c b/sound/soc/codecs/tpa6130a2.c index 5f00bfc32917..696a27b472aa 100644 --- a/sound/soc/codecs/tpa6130a2.c +++ b/sound/soc/codecs/tpa6130a2.c @@ -9,15 +9,15 @@ #include #include +#include #include #include -#include +#include #include #include #include #include #include -#include #include #include "tpa6130a2.h" @@ -32,7 +32,7 @@ struct tpa6130a2_data { struct device *dev; struct regmap *regmap; struct regulator *supply; - int power_gpio; + struct gpio_desc *power_gpio; enum tpa_model id; }; @@ -48,8 +48,8 @@ static int tpa6130a2_power(struct tpa6130a2_data *data, bool enable) return ret; } /* Power on */ - if (data->power_gpio >= 0) - gpio_set_value(data->power_gpio, 1); + if (data->power_gpio) + gpiod_set_value(data->power_gpio, 1); /* Sync registers */ regcache_cache_only(data->regmap, false); @@ -58,8 +58,8 @@ static int tpa6130a2_power(struct tpa6130a2_data *data, bool enable) dev_err(data->dev, "Failed to sync registers: %d\n", ret); regcache_cache_only(data->regmap, true); - if (data->power_gpio >= 0) - gpio_set_value(data->power_gpio, 0); + if (data->power_gpio) + gpiod_set_value(data->power_gpio, 0); ret2 = regulator_disable(data->supply); if (ret2 != 0) dev_err(data->dev, @@ -75,8 +75,8 @@ static int tpa6130a2_power(struct tpa6130a2_data *data, bool enable) regcache_cache_only(data->regmap, true); /* Power off */ - if (data->power_gpio >= 0) - gpio_set_value(data->power_gpio, 0); + if (data->power_gpio) + gpiod_set_value(data->power_gpio, 0); ret = regulator_disable(data->supply); if (ret != 0) { @@ -224,37 +224,29 @@ static int tpa6130a2_probe(struct i2c_client *client) unsigned int version; int ret; - if (!dev->of_node) - return -ENODEV; - data = devm_kzalloc(&client->dev, sizeof(*data), GFP_KERNEL); if (!data) return -ENOMEM; + i2c_set_clientdata(client, data); data->dev = dev; data->regmap = devm_regmap_init_i2c(client, &tpa6130a2_regmap_config); if (IS_ERR(data->regmap)) return PTR_ERR(data->regmap); - data->power_gpio = of_get_named_gpio(dev->of_node, "power-gpio", 0); + data->power_gpio = devm_gpiod_get_optional(dev, "power", GPIOD_OUT_LOW); + ret = PTR_ERR_OR_ZERO(data->power_gpio); + if (ret) { + dev_err(dev, "Failed to request power GPIO: %d\n", ret); + return ret; + } - i2c_set_clientdata(client, data); + gpiod_set_consumer_name(data->power_gpio, "tpa6130a2 enable"); id = i2c_match_id(tpa6130a2_id, client); data->id = id->driver_data; - if (data->power_gpio >= 0) { - ret = devm_gpio_request(dev, data->power_gpio, - "tpa6130a2 enable"); - if (ret < 0) { - dev_err(dev, "Failed to request power GPIO (%d)\n", - data->power_gpio); - return ret; - } - gpio_direction_output(data->power_gpio, 0); - } - switch (data->id) { default: dev_warn(dev, "Unknown TPA model (%d). Assuming 6130A2\n", From patchwork Wed Nov 16 05:38:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 13044420 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 EC9CBC4332F for ; Wed, 16 Nov 2022 05:41:59 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 2113D16CC; Wed, 16 Nov 2022 06:41:08 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 2113D16CC DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1668577318; bh=kOVeXAGDxXuk8SXxyFL9iBG/LS1QzockFAjJIiioGKk=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=S4/LMGAY1QV4MSgfrc9izto7wxRbb0e9c7quXIdRRcqzpVDPrE8dT6OhuPJmypl+g sq4UxHFDaHAjQikK/ZxcEcpw0cq3GSAgNwc+Xg79V/JmbMMAlW94T9i0UAdiAUDC85 iJR90T3WfWGcjnoxu7BBiADPCfiDwz9QHrngS6pw= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 63E03F805AF; Wed, 16 Nov 2022 06:38:56 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 5038AF805B4; Wed, 16 Nov 2022 06:38:55 +0100 (CET) Received: from mail-pj1-x1036.google.com (mail-pj1-x1036.google.com [IPv6:2607:f8b0:4864:20::1036]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 155C5F80549 for ; Wed, 16 Nov 2022 06:38:33 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 155C5F80549 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Rz/H6Ys2" Received: by mail-pj1-x1036.google.com with SMTP id v4-20020a17090a088400b00212cb0ed97eso1335086pjc.5 for ; Tue, 15 Nov 2022 21:38:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=xwwwsx9jfrJYamHfIH6HX3vvIu1imMZZ+4VMVekHngI=; b=Rz/H6Ys2b4kWwW4r+rY3Jxp4B3laBIYMyVHy+ATKWcjmUG6PH8ujJdN8Fi/r9jAO6M zXmJUNicma4dyKgKg7LASOVGFUZ5nuYwk3YNKQ3yqEGHLcAVDb5FF8XBSdfWOeqIf+qP MxutMrZhNcpgQLhQNUK4Ds57v2FY6T/uFnq8r0RpFNN35QPG4adlGJo2hlyKRwYVwkd6 aFiVWAkUxmHqw//S4QM9JYBRZGwP9/DiToLBd1477MPMIzzW4QhM5CU+Z7djk/4DobR2 9PHSXED1uBKmfG91qTCVmZljBbLQ6NZMdE/Fr8ILkV3lB2ecEmECyatxEo1kbcwvwdrh Q6hg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=xwwwsx9jfrJYamHfIH6HX3vvIu1imMZZ+4VMVekHngI=; b=ZZjpyRRn9LnX3hvXMECQxwUGSO0wZQaYwj6nh69vE/M6ikUBka5UeMqq1G9nU8F/in AB488em4dS2Y4mrhBlALfIQykaPeczuQmfh38qg1NMX9zbCONXgASUbK469O+HobEtNb V+IFdLJsYwdS+x3SbbhEY2v8DegcstJi2Xsq2rYlYtxQ4wLN2SME7CjkrCfXFr65yW6z TbL7Rwr2eH6AzLz5hHiNZ4sgZz96GQ8RRXwggQUtQ+OvNLn7NH6Kyz949TphHQQ3+q/X 4pvQb4mfA3fOsta0ZLJziRCZMx5+Lcnd4HmSe8cZ8/d1TG+vf696oMunmkXgZUo1pat9 idKA== X-Gm-Message-State: ANoB5pmqnKz980z2jGri735dW8HXViwansQI6vwdZdTKasbK578HjS3B 3lEvkbtM34bB7u36VT4PhnI= X-Google-Smtp-Source: AA0mqf5l1i6JvOL677NV16OYZ271oU6KdmQuaLgLz6SgdGOyQljKX6FdQNZvo2/6XxEUOK0zI/8Aqg== X-Received: by 2002:a17:902:900b:b0:17f:8544:e0dd with SMTP id a11-20020a170902900b00b0017f8544e0ddmr7619256plp.34.1668577111537; Tue, 15 Nov 2022 21:38:31 -0800 (PST) Received: from dtor-ws.mtv.corp.google.com ([2620:15c:9d:2:2d36:e9a0:170b:669f]) by smtp.gmail.com with ESMTPSA id ik13-20020a170902ab0d00b0017834a6966csm10881038plb.176.2022.11.15.21.38.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Nov 2022 21:38:30 -0800 (PST) From: Dmitry Torokhov To: Mark Brown , Liam Girdwood Subject: [PATCH 06/11] ASoC: tlv320aic32x4: remove support for platform data Date: Tue, 15 Nov 2022 21:38:12 -0800 Message-Id: <20221116053817.2929810-6-dmitry.torokhov@gmail.com> X-Mailer: git-send-email 2.38.1.431.g37b22c650d-goog In-Reply-To: <20221116053817.2929810-1-dmitry.torokhov@gmail.com> References: <20221116053817.2929810-1-dmitry.torokhov@gmail.com> MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" There are no users of aic32x4_pdata in the mainline kernel, remove it. Signed-off-by: Dmitry Torokhov --- include/sound/tlv320aic32x4.h | 52 -------------------------------- sound/soc/codecs/tlv320aic32x4.c | 14 +++------ sound/soc/codecs/tlv320aic32x4.h | 27 +++++++++++++++++ 3 files changed, 32 insertions(+), 61 deletions(-) delete mode 100644 include/sound/tlv320aic32x4.h diff --git a/include/sound/tlv320aic32x4.h b/include/sound/tlv320aic32x4.h deleted file mode 100644 index 0abf74d7edbd..000000000000 --- a/include/sound/tlv320aic32x4.h +++ /dev/null @@ -1,52 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ -/* - * tlv320aic32x4.h -- TLV320AIC32X4 Soc Audio driver platform data - * - * Copyright 2011 Vista Silicon S.L. - * - * Author: Javier Martin - */ - -#ifndef _AIC32X4_PDATA_H -#define _AIC32X4_PDATA_H - -#define AIC32X4_PWR_MICBIAS_2075_LDOIN 0x00000001 -#define AIC32X4_PWR_AVDD_DVDD_WEAK_DISABLE 0x00000002 -#define AIC32X4_PWR_AIC32X4_LDO_ENABLE 0x00000004 -#define AIC32X4_PWR_CMMODE_LDOIN_RANGE_18_36 0x00000008 -#define AIC32X4_PWR_CMMODE_HP_LDOIN_POWERED 0x00000010 - -#define AIC32X4_MICPGA_ROUTE_LMIC_IN2R_10K 0x00000001 -#define AIC32X4_MICPGA_ROUTE_RMIC_IN1L_10K 0x00000002 - -/* GPIO API */ -#define AIC32X4_MFPX_DEFAULT_VALUE 0xff - -#define AIC32X4_MFP1_DIN_DISABLED 0 -#define AIC32X4_MFP1_DIN_ENABLED 0x2 -#define AIC32X4_MFP1_GPIO_IN 0x4 - -#define AIC32X4_MFP2_GPIO_OUT_LOW 0x0 -#define AIC32X4_MFP2_GPIO_OUT_HIGH 0x1 - -#define AIC32X4_MFP_GPIO_ENABLED 0x4 - -#define AIC32X4_MFP5_GPIO_DISABLED 0x0 -#define AIC32X4_MFP5_GPIO_INPUT 0x8 -#define AIC32X4_MFP5_GPIO_OUTPUT 0xc -#define AIC32X4_MFP5_GPIO_OUT_LOW 0x0 -#define AIC32X4_MFP5_GPIO_OUT_HIGH 0x1 - -struct aic32x4_setup_data { - unsigned int gpio_func[5]; -}; - -struct aic32x4_pdata { - struct aic32x4_setup_data *setup; - u32 power_cfg; - u32 micpga_routing; - bool swapdacs; - int rstn_gpio; -}; - -#endif diff --git a/sound/soc/codecs/tlv320aic32x4.c b/sound/soc/codecs/tlv320aic32x4.c index ffe1828a4b7e..2dd0fe255ee6 100644 --- a/sound/soc/codecs/tlv320aic32x4.c +++ b/sound/soc/codecs/tlv320aic32x4.c @@ -22,7 +22,6 @@ #include #include -#include #include #include #include @@ -33,6 +32,10 @@ #include "tlv320aic32x4.h" +struct aic32x4_setup_data { + unsigned int gpio_func[5]; +}; + struct aic32x4_priv { struct regmap *regmap; u32 power_cfg; @@ -1336,7 +1339,6 @@ static int aic32x4_setup_regulators(struct device *dev, int aic32x4_probe(struct device *dev, struct regmap *regmap) { struct aic32x4_priv *aic32x4; - struct aic32x4_pdata *pdata = dev->platform_data; struct device_node *np = dev->of_node; int ret; @@ -1353,13 +1355,7 @@ int aic32x4_probe(struct device *dev, struct regmap *regmap) dev_set_drvdata(dev, aic32x4); - if (pdata) { - aic32x4->power_cfg = pdata->power_cfg; - aic32x4->swapdacs = pdata->swapdacs; - aic32x4->micpga_routing = pdata->micpga_routing; - aic32x4->rstn_gpio = pdata->rstn_gpio; - aic32x4->mclk_name = "mclk"; - } else if (np) { + if (np) { ret = aic32x4_parse_dt(aic32x4, np); if (ret) { dev_err(dev, "Failed to parse DT node\n"); diff --git a/sound/soc/codecs/tlv320aic32x4.h b/sound/soc/codecs/tlv320aic32x4.h index 4de5bd9e8cc5..f0724b6b17ee 100644 --- a/sound/soc/codecs/tlv320aic32x4.h +++ b/sound/soc/codecs/tlv320aic32x4.h @@ -232,4 +232,31 @@ int aic32x4_register_clocks(struct device *dev, const char *mclk_name); #define AIC32X4_MAX_CODEC_CLKIN_FREQ 110000000 #define AIC32X4_MAX_PLL_CLKIN 20000000 +#define AIC32X4_PWR_MICBIAS_2075_LDOIN 0x00000001 +#define AIC32X4_PWR_AVDD_DVDD_WEAK_DISABLE 0x00000002 +#define AIC32X4_PWR_AIC32X4_LDO_ENABLE 0x00000004 +#define AIC32X4_PWR_CMMODE_LDOIN_RANGE_18_36 0x00000008 +#define AIC32X4_PWR_CMMODE_HP_LDOIN_POWERED 0x00000010 + +#define AIC32X4_MICPGA_ROUTE_LMIC_IN2R_10K 0x00000001 +#define AIC32X4_MICPGA_ROUTE_RMIC_IN1L_10K 0x00000002 + +/* GPIO API */ +#define AIC32X4_MFPX_DEFAULT_VALUE 0xff + +#define AIC32X4_MFP1_DIN_DISABLED 0 +#define AIC32X4_MFP1_DIN_ENABLED 0x2 +#define AIC32X4_MFP1_GPIO_IN 0x4 + +#define AIC32X4_MFP2_GPIO_OUT_LOW 0x0 +#define AIC32X4_MFP2_GPIO_OUT_HIGH 0x1 + +#define AIC32X4_MFP_GPIO_ENABLED 0x4 + +#define AIC32X4_MFP5_GPIO_DISABLED 0x0 +#define AIC32X4_MFP5_GPIO_INPUT 0x8 +#define AIC32X4_MFP5_GPIO_OUTPUT 0xc +#define AIC32X4_MFP5_GPIO_OUT_LOW 0x0 +#define AIC32X4_MFP5_GPIO_OUT_HIGH 0x1 + #endif /* _TLV320AIC32X4_H */ From patchwork Wed Nov 16 05:38:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 13044416 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 4F180C433FE for ; Wed, 16 Nov 2022 05:40:55 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 7E8A2168E; Wed, 16 Nov 2022 06:40:03 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 7E8A2168E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1668577253; bh=+Q9Xzr8d+Q5o7WfWBABntNrAm1nr1P+gl5vcsD8Cobc=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=E4Pix4AZTU2XlINdA7yxk/hLsDph4vuXdlALSm424rkfKxebeYhQ1WbzSkwpTFzm+ ZTwyZzf6dSbk0cbGgCVghRTYGLRX9UMlrPrYE+BPUr3GiD13gFqAbS/+pbj7Wuukyc 4ryNnBjbz7lwBIA0jFl4Ukslp0BLNx57tdaD8oT4= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 0F02FF8057D; Wed, 16 Nov 2022 06:38:45 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 8AAFCF800B5; Wed, 16 Nov 2022 06:38:41 +0100 (CET) Received: from mail-pj1-x1034.google.com (mail-pj1-x1034.google.com [IPv6:2607:f8b0:4864:20::1034]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 7507AF80163 for ; Wed, 16 Nov 2022 06:38:35 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 7507AF80163 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="WKM+2PzQ" Received: by mail-pj1-x1034.google.com with SMTP id d13-20020a17090a3b0d00b00213519dfe4aso1354386pjc.2 for ; Tue, 15 Nov 2022 21:38:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ULkwCXln6lxM8XLag0GHNaSgcab1VgWTlrPLPEn1RmQ=; b=WKM+2PzQbhMeOBeGQywY/g11Pnn37fKCeJCt+lwYnk221uHqyJTf2HoAQyuSvu64nO brBFlwq5l+XR8hlqRvjKYtb9hsQtQmyeupF7wTqWtL6ovpyDzxx/CR0TmRmccJ2ENp74 CaRfmDhGkLcsG47C1XDf0+LG1i7+nUTJ7M0IGG6NHTDmvdZkDR6nOuvsxyWw3wQRixzZ RTozclXB95iYqCQaPK/PRoE/OFUcDNDDjP2hsVbYgO6qd2lNNa9sn8F+2m/qnwnUqk5v cVcH1Cd7m/3QTkeUpRFRxDU9njOzlNy9rJr5La6m0Ai2k5T9OlZ29M5h1k8XhfV0GMUi Em+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ULkwCXln6lxM8XLag0GHNaSgcab1VgWTlrPLPEn1RmQ=; b=Z/aoqh0SGlgi8Ew+103+iTQSTZfKeHagK+x4D/XXnNgUguv02Ulhg6hGOVjSNAYT1v 6vQR2GBXIxzpD7RXip6HCc5l0fzD0Khllnf6c3YY/Gtp0CWylv20G5sTowGaHjcOPDcR C36B8ZVHv7mSVQ8QkT6BEVtwkp5prRlhdvd7BVocbS+egX2NVXetm8avV8wmQ7lVs1Kg qjPQunzkDV3RHFnynwypejAa6GEVB9TmSWkWlYwo4ulN71wp4X6sIX/PUhJ0F15tGRez hyQdFWrnY2iyr0HU1mlh+6xyAuVEnQmj8tyPVpmD4c0TmjjlK9FmQN4aThJy3G9nl+Em bOyg== X-Gm-Message-State: ANoB5plqxqc/f3734ks6YXuqIZOlM8HMSrIeHJAAW2F+xlZETIfo5TDw y2j4yziWmbsYpRP1RnYvJU5f7dRjQWM= X-Google-Smtp-Source: AA0mqf5uVWst6sre4JVfG7hacQt648w/wagbo1T0Ve8WMKn0tELymV4vaRkGXceh0dDwV+YXo9CPkg== X-Received: by 2002:a17:903:3311:b0:188:4ea8:a687 with SMTP id jk17-20020a170903331100b001884ea8a687mr7401524plb.120.1668577113192; Tue, 15 Nov 2022 21:38:33 -0800 (PST) Received: from dtor-ws.mtv.corp.google.com ([2620:15c:9d:2:2d36:e9a0:170b:669f]) by smtp.gmail.com with ESMTPSA id ik13-20020a170902ab0d00b0017834a6966csm10881038plb.176.2022.11.15.21.38.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Nov 2022 21:38:32 -0800 (PST) From: Dmitry Torokhov To: Mark Brown , Liam Girdwood Subject: [PATCH 07/11] ASoC: tlv320aic32x4: switch to using gpiod API Date: Tue, 15 Nov 2022 21:38:13 -0800 Message-Id: <20221116053817.2929810-7-dmitry.torokhov@gmail.com> X-Mailer: git-send-email 2.38.1.431.g37b22c650d-goog In-Reply-To: <20221116053817.2929810-1-dmitry.torokhov@gmail.com> References: <20221116053817.2929810-1-dmitry.torokhov@gmail.com> MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" Switch the driver from legacy gpio API that is deprecated to the newer gpiod API that respects line polarities described in ACPI/DT. Signed-off-by: Dmitry Torokhov --- sound/soc/codecs/tlv320aic32x4.c | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/sound/soc/codecs/tlv320aic32x4.c b/sound/soc/codecs/tlv320aic32x4.c index 2dd0fe255ee6..36a3b3eb4d56 100644 --- a/sound/soc/codecs/tlv320aic32x4.c +++ b/sound/soc/codecs/tlv320aic32x4.c @@ -13,9 +13,9 @@ #include #include #include +#include #include -#include -#include +#include #include #include #include @@ -41,7 +41,7 @@ struct aic32x4_priv { u32 power_cfg; u32 micpga_routing; bool swapdacs; - int rstn_gpio; + struct gpio_desc *reset_gpio; const char *mclk_name; struct regulator *supply_ldo; @@ -1230,7 +1230,6 @@ static int aic32x4_parse_dt(struct aic32x4_priv *aic32x4, aic32x4->swapdacs = false; aic32x4->micpga_routing = 0; - aic32x4->rstn_gpio = of_get_named_gpio(np, "reset-gpios", 0); if (of_property_read_u32_array(np, "aic32x4-gpio-func", aic32x4_setup->gpio_func, 5) >= 0) @@ -1365,16 +1364,16 @@ int aic32x4_probe(struct device *dev, struct regmap *regmap) aic32x4->power_cfg = 0; aic32x4->swapdacs = false; aic32x4->micpga_routing = 0; - aic32x4->rstn_gpio = -1; aic32x4->mclk_name = "mclk"; } - if (gpio_is_valid(aic32x4->rstn_gpio)) { - ret = devm_gpio_request_one(dev, aic32x4->rstn_gpio, - GPIOF_OUT_INIT_LOW, "tlv320aic32x4 rstn"); - if (ret != 0) - return ret; - } + aic32x4->reset_gpio = devm_gpiod_get_optional(dev, "reset", + GPIOD_OUT_HIGH); + ret = PTR_ERR_OR_ZERO(aic32x4->reset_gpio); + if (ret) + return ret; + + gpiod_set_consumer_name(aic32x4->reset_gpio, "tlv320aic32x4 rstn"); ret = aic32x4_setup_regulators(dev, aic32x4); if (ret) { @@ -1382,9 +1381,9 @@ int aic32x4_probe(struct device *dev, struct regmap *regmap) return ret; } - if (gpio_is_valid(aic32x4->rstn_gpio)) { + if (aic32x4->reset_gpio) { ndelay(10); - gpio_set_value_cansleep(aic32x4->rstn_gpio, 1); + gpiod_set_value_cansleep(aic32x4->reset_gpio, 0); mdelay(1); } From patchwork Wed Nov 16 05:38:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 13044421 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 457C6C4332F for ; Wed, 16 Nov 2022 05:42:15 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 6E58E1682; Wed, 16 Nov 2022 06:41:23 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 6E58E1682 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1668577333; bh=kX/JKGPTVpCVsC1Ry+4LVq9u/MVor/OzWoqVfob66XA=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=bXDk3irMy8slT1f5oHfyLh3nzFRz0NtPvRfXxP3/m9+MVJdrHOLDjMG8jieezQrcq +ukXQ+RfqkRbgQgIMOxvQ8QoUaaaXpUAYqpBldg30ZpZ4QY/gkc4oSEnjNe0+fqH8G /5ozIwr+ZNEBp2mR84cng0MZItx8aKNcxcnVY4d8= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 45C57F805B2; Wed, 16 Nov 2022 06:38:57 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 601ABF80563; Wed, 16 Nov 2022 06:38:55 +0100 (CET) Received: from mail-pf1-x434.google.com (mail-pf1-x434.google.com [IPv6:2607:f8b0:4864:20::434]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 60D02F80563 for ; Wed, 16 Nov 2022 06:38:38 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 60D02F80563 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="FdiOzIGo" Received: by mail-pf1-x434.google.com with SMTP id 140so15023807pfz.6 for ; Tue, 15 Nov 2022 21:38:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=PI/Dm8Xn6WniktdX7f/nHoTvWtwHm/H0w1CeN5e56Wg=; b=FdiOzIGoubl3ylDJ4lEbihqGx6GfPoOlTI+RmmWDK+WcYsnRSZUWPAHqNsO7JqQOhP HHWv2k57KZmxMnVz7Vg5/t0q5d/X+ZAnSobweFcquLpO27kqyM14vA/q1knI7/pKtWiV yu+0f5rKkHGOVOwo4Dwedj3jxrvGASm8QZLmCO8VGmhjNiTWKhcjSjmKOkwn/2QKLHuK WuwERwYNTksL8zv+t7VgVmVtf4l4XTOPMxTC2ETVdBB7cPOqgEnX5mNIwg0SOmXc3UiK t2welHGhT4I2vZJCOLDoAa1ndbstNuuwNsQHuJ+JSYt+Zg1nyMtP/3wgzatOZ1aZjNRI EEqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=PI/Dm8Xn6WniktdX7f/nHoTvWtwHm/H0w1CeN5e56Wg=; b=Whr+d1UAfM/NZJP5Baqp+AOK9yU12rYqRNT+sLT5EDmJ4UtezrtYFTrOKiVP3A/fuD nXmuv45VUsxc7BDqq1QfCEVcoxNoTBxV8sekEJ0R86A5SrhdAFVQCxEqdvb22OBOj41u P2GQcAH5wszlPibpeMauB5B7UAlKlbWAzTm10+Lw/ohnzABmGXEwy/XQB3yF8CLhPXlB dVphZEvg1HY+/j76Lo7b8vshRX5vAUlQtiRI7AkYCnV2IHZDkRHghDsXgEqZp0LYv9o4 Y76G/06NqefZ4Jpwa9u7wL0P+W3OVtUSHmizv9PvD12kXSL+3UTKBwsuh0yrNeqGHnOF qrWg== X-Gm-Message-State: ANoB5pkt+zN9XGUTNYH94//Zk5HvRS1O2yfp+TaMQ1O386bndbqS7YO8 SXKr+FDgxin8nVZPhuFRyvg= X-Google-Smtp-Source: AA0mqf6tk4n1dLo2nIOqIKkMGMQQJiQhYcFaLRx5eEWqbalX+e19mG1wrZvjtwV/DOOFKmlOgiSJJw== X-Received: by 2002:a63:fd42:0:b0:426:9c23:97da with SMTP id m2-20020a63fd42000000b004269c2397damr19863493pgj.2.1668577115229; Tue, 15 Nov 2022 21:38:35 -0800 (PST) Received: from dtor-ws.mtv.corp.google.com ([2620:15c:9d:2:2d36:e9a0:170b:669f]) by smtp.gmail.com with ESMTPSA id ik13-20020a170902ab0d00b0017834a6966csm10881038plb.176.2022.11.15.21.38.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Nov 2022 21:38:34 -0800 (PST) From: Dmitry Torokhov To: Mark Brown , Liam Girdwood Subject: [PATCH 08/11] ASoC: dt-bindings: wcd9335: fix reset line polarity in example Date: Tue, 15 Nov 2022 21:38:14 -0800 Message-Id: <20221116053817.2929810-8-dmitry.torokhov@gmail.com> X-Mailer: git-send-email 2.38.1.431.g37b22c650d-goog In-Reply-To: <20221116053817.2929810-1-dmitry.torokhov@gmail.com> References: <20221116053817.2929810-1-dmitry.torokhov@gmail.com> MIME-Version: 1.0 Cc: Krzysztof Kozlowski , alsa-devel@alsa-project.org, Rob Herring , linux-kernel@vger.kernel.org, Krzysztof Kozlowski X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" When resetting the block, the reset line is being driven low and then high, which means that the line in DTS should be annotated as "active low". Fixes: 1877c9fda1b7 ("ASoC: dt-bindings: add dt bindings for wcd9335 audio codec") Acked-by: Krzysztof Kozlowski Signed-off-by: Dmitry Torokhov --- This was sent out previously as part of other series. Collected Krzysztof's ack. Documentation/devicetree/bindings/sound/qcom,wcd9335.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/sound/qcom,wcd9335.txt b/Documentation/devicetree/bindings/sound/qcom,wcd9335.txt index 5d6ea66a863f..1f75feec3dec 100644 --- a/Documentation/devicetree/bindings/sound/qcom,wcd9335.txt +++ b/Documentation/devicetree/bindings/sound/qcom,wcd9335.txt @@ -109,7 +109,7 @@ audio-codec@1{ reg = <1 0>; interrupts = <&msmgpio 54 IRQ_TYPE_LEVEL_HIGH>; interrupt-names = "intr2" - reset-gpios = <&msmgpio 64 0>; + reset-gpios = <&msmgpio 64 GPIO_ACTIVE_LOW>; slim-ifc-dev = <&wc9335_ifd>; clock-names = "mclk", "native"; clocks = <&rpmcc RPM_SMD_DIV_CLK1>, From patchwork Wed Nov 16 05:38:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 13044417 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 2031BC4332F for ; Wed, 16 Nov 2022 05:41:11 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id DAEDF1685; Wed, 16 Nov 2022 06:40:18 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz DAEDF1685 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1668577268; bh=zsVkFNjGPofi3QgzxxaffFfxPw2sD6i15hzRnkkW3xQ=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=FJ8J6XeytodfM5LV0JJiJ51HNvZiP+ESphFF/GidITZv0au0/5No3IwvFdqNrAy59 hHqPt1urp+gfZueCfaUrfrl9RW1vDcfoa2mYoqUwg+GT9YZBXM6dXnMxKp9JZpw0V1 zCVGFpzg1jMswpDrFUjDjFYrKJOGaSJ0ZfjtKARY= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id CFC9DF80587; Wed, 16 Nov 2022 06:38:49 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id CDD33F8057E; Wed, 16 Nov 2022 06:38:44 +0100 (CET) Received: from mail-pj1-x1029.google.com (mail-pj1-x1029.google.com [IPv6:2607:f8b0:4864:20::1029]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id C3F82F80163 for ; Wed, 16 Nov 2022 06:38:40 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz C3F82F80163 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="isKr2CHW" Received: by mail-pj1-x1029.google.com with SMTP id d59-20020a17090a6f4100b00213202d77e1so1293728pjk.2 for ; Tue, 15 Nov 2022 21:38:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=hTyuvgruJxkGjK2lPmWOPAqXK8rk+Mma5cjclFSB/P4=; b=isKr2CHWgMPKfi62JRy35GEXHE5fa0vHOmDyfUegLY1FC8fuXQTi14lkZ/Gr1JWyqp apNloEjjEmXw7M4yebsCw0DkxcZtGuUQvYT2z6GJNsEQbKbPJSGLTrWt0gZgauQ5RSyS pZS/0BrY0+rd8pRdk2lxCxsOUIUm53iOeRTpgulfwpPvgT9xrh6s6AJpOyc2K8e47dod jkAzUlTVwKflYnao+eZWJ0bxf7nxTWI9ACCIsO7G4YT/6sC7K9P4byJCz+nePkePvYB+ Izq9DLBzzVD55oEnvQjvHDMuvtMVfDHAjHk3yJmrvjBuXtw/X4dqqN2ORECgAbfL5xYE Nj/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=hTyuvgruJxkGjK2lPmWOPAqXK8rk+Mma5cjclFSB/P4=; b=M6nvg16Vr4YNcTrMXV4T1mfBjwsNQr4xXyPW/TbX3LfnCchroDdiO9gNWyTE1qHyMW irj9lXN2idVlbFrZM3ukpMq3C41Ur2dZJUpPjc5iBhjnVOUwEd4GGr3LzL0nVIwFL6Hn TRdN3yXTiUlX0tcB8Wytji+D0sxqW9DRZrf3lTK5+y5LIN9kL1Bv90Z0gkXPh4Vd2msP dIE2kquvCHemBbD/kbR8+GDXWpBXHz0TvtMTQveRZZvgxEmyMy4duNb+/ukTwyK2kayY 4Q0cket8Dyo2GtJj0VX4x/UnlGcnirlXKpD2nUuzzvck/dlShJY22cB6Y9NudWLk6w3Z f5nw== X-Gm-Message-State: ANoB5pl934ndjH5cMbu3mcYqkvl1MDSZcoldLwdlPEnTjlbAqQDL4+5F ursohyAhdWioYmRaVCtvEKU= X-Google-Smtp-Source: AA0mqf7T9R9bl1VF3b67lvjkzgbb0ZPUNJ3DTdNrfya/g9dsluA4pZrfvDVx2bshz7znLR5EfemOyg== X-Received: by 2002:a17:902:b781:b0:186:8a1e:5055 with SMTP id e1-20020a170902b78100b001868a1e5055mr7368084pls.116.1668577117200; Tue, 15 Nov 2022 21:38:37 -0800 (PST) Received: from dtor-ws.mtv.corp.google.com ([2620:15c:9d:2:2d36:e9a0:170b:669f]) by smtp.gmail.com with ESMTPSA id ik13-20020a170902ab0d00b0017834a6966csm10881038plb.176.2022.11.15.21.38.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Nov 2022 21:38:36 -0800 (PST) From: Dmitry Torokhov To: Mark Brown , Liam Girdwood Subject: [PATCH 09/11] ASoC: wcd9335: switch to using gpiod API Date: Tue, 15 Nov 2022 21:38:15 -0800 Message-Id: <20221116053817.2929810-9-dmitry.torokhov@gmail.com> X-Mailer: git-send-email 2.38.1.431.g37b22c650d-goog In-Reply-To: <20221116053817.2929810-1-dmitry.torokhov@gmail.com> References: <20221116053817.2929810-1-dmitry.torokhov@gmail.com> MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" Switch the driver from legacy gpio API that is deprecated to the newer gpiod API that respects line polarities described in ACPI/DT. Also the old code did not actually request the reset line, but was toggling it directly; this has been fixed. Signed-off-by: Dmitry Torokhov --- sound/soc/codecs/wcd9335.c | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/sound/soc/codecs/wcd9335.c b/sound/soc/codecs/wcd9335.c index d2548fdf9ae5..27cbec3e6763 100644 --- a/sound/soc/codecs/wcd9335.c +++ b/sound/soc/codecs/wcd9335.c @@ -11,12 +11,13 @@ #include #include #include +#include +#include #include #include #include #include #include -#include #include #include #include @@ -329,7 +330,7 @@ struct wcd9335_codec { int comp_enabled[COMPANDER_MAX]; int intr1; - int reset_gpio; + struct gpio_desc *reset_gpio; struct regulator_bulk_data supplies[WCD9335_MAX_SUPPLY]; unsigned int rx_port_value[WCD9335_RX_MAX]; @@ -5032,25 +5033,27 @@ static const struct regmap_irq_chip wcd9335_regmap_irq1_chip = { static int wcd9335_parse_dt(struct wcd9335_codec *wcd) { struct device *dev = wcd->dev; - struct device_node *np = dev->of_node; int ret; - wcd->reset_gpio = of_get_named_gpio(np, "reset-gpios", 0); - if (wcd->reset_gpio < 0) { - dev_err(dev, "Reset GPIO missing from DT\n"); - return wcd->reset_gpio; + wcd->reset_gpio = devm_gpiod_get(dev, "reset", GPIOD_OUT_LOW); + ret = PTR_ERR_OR_ZERO(wcd->reset_gpio); + if (ret) { + dev_err(dev, "failed to request reset GPIO: %d\n", ret); + return ret; } wcd->mclk = devm_clk_get(dev, "mclk"); - if (IS_ERR(wcd->mclk)) { - dev_err(dev, "mclk not found\n"); - return PTR_ERR(wcd->mclk); + ret = PTR_ERR_OR_ZERO(wcd->mclk); + if (ret) { + dev_err(dev, "mclk not found: %d\n", ret); + return ret; } wcd->native_clk = devm_clk_get(dev, "slimbus"); - if (IS_ERR(wcd->native_clk)) { - dev_err(dev, "slimbus clock not found\n"); - return PTR_ERR(wcd->native_clk); + ret = PTR_ERR_OR_ZERO(wcd->native_clk); + if (ret) { + dev_err(dev, "slimbus clock not found: %d\n", ret); + return ret; } wcd->supplies[0].supply = "vdd-buck"; @@ -5088,9 +5091,9 @@ static int wcd9335_power_on_reset(struct wcd9335_codec *wcd) */ usleep_range(600, 650); - gpio_direction_output(wcd->reset_gpio, 0); + gpiod_set_value_cansleep(wcd->reset_gpio, 1); msleep(20); - gpio_set_value(wcd->reset_gpio, 1); + gpiod_set_value_cansleep(wcd->reset_gpio, 0); msleep(20); return 0; From patchwork Wed Nov 16 05:38:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 13044419 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 6ACC6C4332F for ; Wed, 16 Nov 2022 05:41:47 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 93DB116A1; Wed, 16 Nov 2022 06:40:55 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 93DB116A1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1668577305; bh=Xcr7yWXexdOaX1ye8F4zIjxTF6OwDP6ADzVojvAMJvo=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=dWO3xFgiKc4uCjNRhBaIOb9mOmUHnuntGyEfu4LslDd2MCzyCqurYt/KgWAYfak6n rnDJVmM1QH+Mj2hRtTw6H6riXHoJcxZGKPJg9y8eQ+39Nuzh4ZGl08HEicdqaOSk+h LXGIncAhfr6ewVeqEVRttcQ+xvYbbQwmvMWjoeMY= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id B8F89F805AE; Wed, 16 Nov 2022 06:38:52 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 21DBAF8059F; Wed, 16 Nov 2022 06:38:51 +0100 (CET) Received: from mail-pf1-x435.google.com (mail-pf1-x435.google.com [IPv6:2607:f8b0:4864:20::435]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 83566F80571 for ; Wed, 16 Nov 2022 06:38:42 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 83566F80571 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ZRenwPio" Received: by mail-pf1-x435.google.com with SMTP id y13so16486829pfp.7 for ; Tue, 15 Nov 2022 21:38:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=4MEFKtk2jr+pIrd01Y8QsB7lxnOrOB6iK6YPYP1nPMA=; b=ZRenwPioW9g8p00PEamyGH8jzVZok76Ys2CSw60kjNNdSavkAdfHlfoLivu3CxFHJs A8oJU7Cd0PUGcEYCpbZmnuUfoF+/2mJE7q9IFfVdJEOkIx9H/rrf3tWqnxpFy+ibOpw+ hKAHZZh68owi/D985vbBZkzUYBsNW5EySLu9t/fW/TPXI/KRtNoqfdugUHrGqOy2A5cz X296GIv47gk0p29rBQ8rsjNbe9Iuq0DF69sugsWyXAiO+WWAZhQw/nT/MawRF4yfiofC xZpEb0ZxygrvpdDQBmMFf/d4gC/1eoW1GW5/X8+uNFS31b7DdyxDChWAIrvnn+D/SR5+ LXXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=4MEFKtk2jr+pIrd01Y8QsB7lxnOrOB6iK6YPYP1nPMA=; b=cL1ySCaX5ywzpDixO0J3N2ZKN8NrzAR1vDfdFjRCwWXcrp+D9dKLTcylTUJzr/v4i8 X3WWNs+R9nYMxZjDaeBBR030lIifYqj1hXWom92fRo0bs8D0YqKLtHjSaAt2oF96HVX+ /YTHUqWVlU0dxiptabwX4jBMLiHtYDCbI7VSZRdv5WwMc8/iTM4X4PSNSXKVNEfH0BVp B7CXVabukIakmtsNae3CNDam5zLBzrCzfs+4rpJV/dESMlILCrAjOFkeN46rcAp5Hi6k RxvLM2Ykh9RtBx2wjUE2YfoUaVblmYHJgFZfUFl3PS2bvrfG+0NwRDTdHP0ay3av/ccC SUVw== X-Gm-Message-State: ANoB5plET2e+1xy/uhPjTriBNO0EFT0lKwL5MxmSiVNfJ5/JvudreYmG Y4Dg40Ru3ALHsS3XXGLWWO8= X-Google-Smtp-Source: AA0mqf6ex8aOz3bvEsY002H/DOqXJxnAt++xm328WBIajR1/qG4sKD8ytPpIYYxQvfoosCQyWL52YQ== X-Received: by 2002:a62:6001:0:b0:52f:db84:81cf with SMTP id u1-20020a626001000000b0052fdb8481cfmr22052595pfb.26.1668577119040; Tue, 15 Nov 2022 21:38:39 -0800 (PST) Received: from dtor-ws.mtv.corp.google.com ([2620:15c:9d:2:2d36:e9a0:170b:669f]) by smtp.gmail.com with ESMTPSA id ik13-20020a170902ab0d00b0017834a6966csm10881038plb.176.2022.11.15.21.38.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Nov 2022 21:38:38 -0800 (PST) From: Dmitry Torokhov To: Mark Brown , Liam Girdwood Subject: [PATCH 10/11] ASoC: dt-bindings: wcd938x: fix codec reset line polarity in example Date: Tue, 15 Nov 2022 21:38:16 -0800 Message-Id: <20221116053817.2929810-10-dmitry.torokhov@gmail.com> X-Mailer: git-send-email 2.38.1.431.g37b22c650d-goog In-Reply-To: <20221116053817.2929810-1-dmitry.torokhov@gmail.com> References: <20221116053817.2929810-1-dmitry.torokhov@gmail.com> MIME-Version: 1.0 Cc: Krzysztof Kozlowski , alsa-devel@alsa-project.org, Rob Herring , linux-kernel@vger.kernel.org, Krzysztof Kozlowski X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" The driver for the codec, when resetting the chip, first drives the line low, and then high. This means that the line is active low. Change the annotation in the example DTS accordingly. Acked-by: Krzysztof Kozlowski Signed-off-by: Dmitry Torokhov --- This was sent out previously as part of other series. Collected Krzysztof's ack and added missing include per Rob's feedback. Documentation/devicetree/bindings/sound/qcom,wcd938x.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/sound/qcom,wcd938x.yaml b/Documentation/devicetree/bindings/sound/qcom,wcd938x.yaml index 51547190f709..3cb542d559c6 100644 --- a/Documentation/devicetree/bindings/sound/qcom,wcd938x.yaml +++ b/Documentation/devicetree/bindings/sound/qcom,wcd938x.yaml @@ -110,9 +110,10 @@ additionalProperties: false examples: - | + #include codec { compatible = "qcom,wcd9380-codec"; - reset-gpios = <&tlmm 32 0>; + reset-gpios = <&tlmm 32 GPIO_ACTIVE_LOW>; #sound-dai-cells = <1>; qcom,tx-device = <&wcd938x_tx>; qcom,rx-device = <&wcd938x_rx>; From patchwork Wed Nov 16 05:38:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 13044418 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 612C2C4332F for ; Wed, 16 Nov 2022 05:41:23 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 884D61694; Wed, 16 Nov 2022 06:40:31 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 884D61694 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1668577281; bh=MqYVBm1MALPjfQ33UeddpZHm+HPXOJ9xjCGd4D6rVSM=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=e9eAW2lj5nBsmBcX82m+FEeIGhoZWtRhvOyoV/6VM6xy4qxwmWsyM42KVno4LFwWb rDYdgdGo/LOlG/Lqj2q88TtILnFZdkh5+vRFN4ERZLMDcA/5VxZOqoM6supNda2a8/ ra68ysxkrwvkR13w/xvs/1Lp5ZX+2ny4fuNB0mPQ= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 92A13F8058C; Wed, 16 Nov 2022 06:38:51 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 838B7F80588; Wed, 16 Nov 2022 06:38:49 +0100 (CET) Received: from mail-pg1-x52c.google.com (mail-pg1-x52c.google.com [IPv6:2607:f8b0:4864:20::52c]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 0A6BBF8057E for ; Wed, 16 Nov 2022 06:38:44 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 0A6BBF8057E Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="AJH+sKrg" Received: by mail-pg1-x52c.google.com with SMTP id q71so15684028pgq.8 for ; Tue, 15 Nov 2022 21:38:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=v1IwnG/hkjmxOvKDimBi/CuJjoVrJcOnhShxdmIQmZM=; b=AJH+sKrgK8wjc0DzG0SIQ7l1SSdtx55kH1AEFOqUsobc7Y7+O7Z44slvWjjsdTpVLE rRI7V8xfg0yqJZef/dCf41xX8Rpc2rgwEOZU8Hfg4hGt5LWXz+sDnLhs0NcG63BJKnMI UhxI0dTqPhc0b3X42PNLFigo/BQNY0g+ZRZt8CKy9CT2P1qk49ESs7VINIvMnRiwiqkw rU6DAMgSR2x9ygBn9BOzq2IJIUr/3EZMWzuwE+rN34PZ0f3rTHTjkmD4dn/KhFKJ+MbD QyeMz2cgGtcXis+IdLypKJgofMzjCDmYAxPtrv7XWDcGSmR2ZQqAmkjNvd96VPx6/HHE s0zQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=v1IwnG/hkjmxOvKDimBi/CuJjoVrJcOnhShxdmIQmZM=; b=ix/vxEy+XzBaYmzZjQPvZduWXzisaW4R+Ljxk2jNH8IX0kMb4HV6H9+qAxoFXZChTN uBNJHKJcZ8DzaIdpLJZnCGb6i3h4J72/NFRm6d5+k0B0/Bus77fK5jP/wk99Ah7IcUZy nD4HVk3tOGyOtPCTiZjNuX5vUKdkVvkxD1rMrNa5yEjnRqJie8XL7CqLBDMeEbHsnJpz 0yxzXpNgcDcJz35l9V1i9NRIB+t71TsT0smTTIqhYtMsQ+g8AgJu2ig0Hso1KzmMY8mP GyWKuWNqmrZpB0sFxzvMuj91/BVJaJyGFCBgw+NZGugWYXWDOvPW7HnSUjyhs017IHFN D8OA== X-Gm-Message-State: ANoB5plscuEWrrrR4oTW9YM38EvfgnnjHeFSILmD/Y8KdC+cOiNS3S04 JPOfuNCSwyObEHSNbFm4wK8= X-Google-Smtp-Source: AA0mqf6NXcALMKPdpbXz4RgcSqvLnP/6gMKWXgP7QBDEKte7NKuqA15W/jE79PCse92kRUTjqGLFWA== X-Received: by 2002:a62:7955:0:b0:56b:e64c:5c7e with SMTP id u82-20020a627955000000b0056be64c5c7emr21484613pfc.18.1668577120853; Tue, 15 Nov 2022 21:38:40 -0800 (PST) Received: from dtor-ws.mtv.corp.google.com ([2620:15c:9d:2:2d36:e9a0:170b:669f]) by smtp.gmail.com with ESMTPSA id ik13-20020a170902ab0d00b0017834a6966csm10881038plb.176.2022.11.15.21.38.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Nov 2022 21:38:40 -0800 (PST) From: Dmitry Torokhov To: Mark Brown , Liam Girdwood Subject: [PATCH 11/11] ASoC: wcd938x: switch to using gpiod API Date: Tue, 15 Nov 2022 21:38:17 -0800 Message-Id: <20221116053817.2929810-11-dmitry.torokhov@gmail.com> X-Mailer: git-send-email 2.38.1.431.g37b22c650d-goog In-Reply-To: <20221116053817.2929810-1-dmitry.torokhov@gmail.com> References: <20221116053817.2929810-1-dmitry.torokhov@gmail.com> MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" Switch the driver from legacy gpio API that is deprecated to the newer gpiod API that respects line polarities described in ACPI/DT. Signed-off-by: Dmitry Torokhov Reviewed-by: Krzysztof Kozlowski Tested-by: Krzysztof Kozlowski --- sound/soc/codecs/wcd938x.c | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/sound/soc/codecs/wcd938x.c b/sound/soc/codecs/wcd938x.c index aca06a4026f3..b85bc750c7e0 100644 --- a/sound/soc/codecs/wcd938x.c +++ b/sound/soc/codecs/wcd938x.c @@ -6,12 +6,14 @@ #include #include #include +#include #include +#include +#include #include #include #include #include -#include #include #include #include @@ -194,7 +196,7 @@ struct wcd938x_priv { int flyback_cur_det_disable; int ear_rx_path; int variant; - int reset_gpio; + struct gpio_desc *reset_gpio; struct gpio_desc *us_euro_gpio; u32 micb1_mv; u32 micb2_mv; @@ -4234,18 +4236,19 @@ static int wcd938x_populate_dt_data(struct wcd938x_priv *wcd938x, struct device struct wcd_mbhc_config *cfg = &wcd938x->mbhc_cfg; int ret; - wcd938x->reset_gpio = of_get_named_gpio(dev->of_node, "reset-gpios", 0); - if (wcd938x->reset_gpio < 0) { - dev_err(dev, "Failed to get reset gpio: err = %d\n", - wcd938x->reset_gpio); - return wcd938x->reset_gpio; + wcd938x->reset_gpio = devm_gpiod_get(dev, "reset", GPIOD_ASIS); + ret = PTR_ERR_OR_ZERO(wcd938x->reset_gpio); + if (ret) { + dev_err(dev, "Failed to get reset gpio: err = %d\n", ret); + return ret; } wcd938x->us_euro_gpio = devm_gpiod_get_optional(dev, "us-euro", GPIOD_OUT_LOW); - if (IS_ERR(wcd938x->us_euro_gpio)) { + ret = PTR_ERR_OR_ZERO(wcd938x->us_euro_gpio); + if (ret) { dev_err(dev, "us-euro swap Control GPIO not found\n"); - return PTR_ERR(wcd938x->us_euro_gpio); + return ret; } cfg->swap_gnd_mic = wcd938x_swap_gnd_mic; @@ -4285,11 +4288,11 @@ static int wcd938x_populate_dt_data(struct wcd938x_priv *wcd938x, struct device static int wcd938x_reset(struct wcd938x_priv *wcd938x) { - gpio_direction_output(wcd938x->reset_gpio, 0); - /* 20us sleep required after pulling the reset gpio to LOW */ + gpiod_set_value_cansleep(wcd938x->reset_gpio, 1); + /* 20us sleep required after asserting the reset gpio */ usleep_range(20, 30); - gpio_set_value(wcd938x->reset_gpio, 1); - /* 20us sleep required after pulling the reset gpio to HIGH */ + gpiod_set_value_cansleep(wcd938x->reset_gpio, 0); + /* 20us sleep required after releasing the reset gpio */ usleep_range(20, 30); return 0;