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: 20722 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp3104650wru; Tue, 15 Nov 2022 21:39:14 -0800 (PST) X-Google-Smtp-Source: AA0mqf6WQ3C+mJJ9NO571dhZRbeUdEnsxNvoDVzV1xegNHrd6QmK6RAraebWVcE9E9nMIn425Lr8 X-Received: by 2002:a17:90b:1886:b0:218:499b:bee9 with SMTP id mn6-20020a17090b188600b00218499bbee9mr2074698pjb.171.1668577154570; Tue, 15 Nov 2022 21:39:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668577154; cv=none; d=google.com; s=arc-20160816; b=uWOOcPJz1C8JCJxpUuS4IJbgFNmtqN5MVC6ThQn37VhFBNFEzIVpia6UtmfQQMZs9c wQIIx1HY0+cSc3d/fKJ7DmGNwjKnOShI3eNZZBfLUi/wx+Icbpu6pmveNR2v4vj03Fm7 XCGQyhaTxeHGNJHQUxYqrabVuCWoWhOj6pCcavFTQQmrfz5Pf1WW4ySThEpK4EFOK8ne 3Pt98xyLWV45woWXdiJ+LNCWU9doUcaLmDhtJ+s5/aoPyqIexQT6SEJs4eKD5Nnz0XPG BuqISIsaNNoRxErngPug+H3gNxUm7z6PLswYD0qGSlAUzSA06ebKPjtVg/SA+ox/CtrF Ny5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=Mv8IbBpLkdekGE7AGRon9TYjB5CPxoZZsopxc+3pauE=; b=qdqv3fz1VaZqkezBPUL2/JrJZxoQrSL8Le88aCyNgT5Xp8t1oxtPvatji1Sznu1ffV 2u74JuEZSr1xGcOUoxYAS3sOdfIWO1gvg2YUfZ/fnjbfEClCfV9V7N2I7zyWgy2P6XXg J9AKC0o5lLr9GJ2sJHZefMQgom7I7M6f1IQC9E2jpaQl2Iq4cGxWbZloTlshbdYrO2NV tg/8VXF/kubEYSf+ZeBWlSCuaUlNAWMcXkQyahvLlVBTF4TP6VDKuJW7xW8AO0VKBK9u gTXRWO1h3eQvuzPRG6kfK12CMCroA0TwnWrCn8qPWfmBL7JH7g2bnz5RbZYFASfb/vsR 7VfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=O9LU0JS8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id lp7-20020a17090b4a8700b0020d457c5083si1217044pjb.147.2022.11.15.21.39.01; Tue, 15 Nov 2022 21:39:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=O9LU0JS8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231733AbiKPFie (ORCPT + 99 others); Wed, 16 Nov 2022 00:38:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54078 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231517AbiKPFi1 (ORCPT ); Wed, 16 Nov 2022 00:38:27 -0500 Received: from mail-pl1-x62f.google.com (mail-pl1-x62f.google.com [IPv6:2607:f8b0:4864:20::62f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9EC382F3AE for ; Tue, 15 Nov 2022 21:38:22 -0800 (PST) Received: by mail-pl1-x62f.google.com with SMTP id b21so15441428plc.9 for ; Tue, 15 Nov 2022 21:38:22 -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=NelaDgCM1RFmIINtS0tVJ1dlGwMqghpot/nQin5+jWMJ7OEL9BkR2q1IC1XK20o8bZ RtekgeYkz/Y81YDBOvD8W2ctLGtE3GzESw8yvuOO8etu6bFhtlBFuHbxdWDKUQ46Ubre SXMd0ld07ZvaZARUmzFhk8hH3oVxCRg5G8HtLSKKJsxWRgtF2FTSwW92xIl3TkR/UXtL /XFhzjxN5uuzlKsbfHLdaKUY5/cFJ05sP5h0yjSWnhUHPbSG4h0n69SnNi8XewU8ibOW jyvTL3IzCDHK4VZwlT6RG3+E/mdQ3hNyczY7wo1AhpAZuG392OLudM+SXnv48ScKf2Kl K9FA== X-Gm-Message-State: ANoB5plW8ep5V9Qc15HSUj8mIuUA7n4eQPTDIUYGH5BkOAi0WU5h937c OEa7/kMJKS1l4Jst4Sub1Eo= 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 Cc: linux-kernel@vger.kernel.org, alsa-devel@alsa-project.org 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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749629958753278087?= X-GMAIL-MSGID: =?utf-8?q?1749629958753278087?= 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: 20728 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp3104915wru; Tue, 15 Nov 2022 21:40:15 -0800 (PST) X-Google-Smtp-Source: AA0mqf57/ccBcnlhWeil1gr/m/YIBkb2GnCV0JDDSybdVVOfW0TgRYwH6EMB+yxmLQ4TOxuocQbU X-Received: by 2002:a17:90b:104f:b0:215:d767:4863 with SMTP id gq15-20020a17090b104f00b00215d7674863mr1967136pjb.233.1668577215224; Tue, 15 Nov 2022 21:40:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668577215; cv=none; d=google.com; s=arc-20160816; b=SODrtg7jT6ThROe2AXC/PanMCLCTIDD5mT5Oa3BTW3VZgmyHeM5mPNPwlBKAfge1Zx Tp1MLc224Lj036ZjBUeg+Bv94sWcnCXKdRiYMrHA9K3cJkvEXudd+y490UHCOr7LDUW9 KbcXfSMj/dIVk56kwXUFsISRWPLJxafTTxDykwUCzSLD1DnG8ygJbZggdKmFo/5KoDAy Y1ToBl4GIptccwvgzkG9WYVHfWMj90yeTpoh7VMJ79nH5a/zYdmu3QmqOPm0ubu0mH7J 2vnZ3uzHI/5OpupiJVFPsC8ea1fUha3UPRmDntmx2wKFmgvaHBAPx5VZSGfhxUYA1jdk 9ocg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=yEUFbdVypOtyoH064OjwzyJ2ZvEG5EnyjXzOQihafjo=; b=Ls6BaPOUC/sxQ+KGFof1pjaZzHO7hdZ2Sr9sDDYnNFkwl7qVkN2tHifBcNlr7pqkL6 oMb8/q+ZrJfB4AXgqvnqMHRGJ2Wg0YZEYTdZsllx4TsOAbrdR/mrnLq3KdVWBAFsRc7t A0JlJZZBAQezIvsvXjxTZnPgqbmOcFb96Ep5o/B1AHSOppGsy+MQLyXuxgBGmZDBcLu0 Y6h6dG4qoyZjmyTBAXOn68H7t/g8joDz/yqdXajXD6IJ+SKDzJ8I868GEVwx/f8CnRPg 6Wf5G46a76zHbqON/y5CZ7xXYFQKsv0IG54ct5W7BnrDW00sQt49XFRWYsC3HrW8LuSk z/Pw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="b5/F1lcF"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n9-20020a1709026a8900b001870c4c2722si13127054plk.299.2022.11.15.21.40.01; Tue, 15 Nov 2022 21:40:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="b5/F1lcF"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231834AbiKPFim (ORCPT + 99 others); Wed, 16 Nov 2022 00:38:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54088 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231659AbiKPFi1 (ORCPT ); Wed, 16 Nov 2022 00:38:27 -0500 Received: from mail-pl1-x62a.google.com (mail-pl1-x62a.google.com [IPv6:2607:f8b0:4864:20::62a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 785C138C for ; Tue, 15 Nov 2022 21:38:24 -0800 (PST) Received: by mail-pl1-x62a.google.com with SMTP id k7so15447672pll.6 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: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=QOp25vNCzHwh63B4JI0KbCn+P9Pp32+UnFaD0U56L8KLc643noldCKGQ40dYFwdRIm O22Wy8TfSNlLhIpRKHOaOOOEMLkN7Yyh3d3cmO5oHJtTtNu/89cJl5169UylfAMqhng2 eqvk5pLTGLThG9lDOobhuPYIs2Y2o83kE9Ueiv5DLXaNlpaK+Fdre46obB5Q8lQe/fSB IZmQKnNZ+/yNU0MIy7G/HVyUU+XGx+EmBXsvpML8G8V2QiRlxn5CIUbWogWN+2Yfw3b+ /UwSN2tYVNQkH/9Ns6nSwOUn3PjQQqet7ET8pv6vUqiggwT9Bq5V2G6fovhKcYfHBaQl yoGA== X-Gm-Message-State: ANoB5pnPfGZ0ogiUIOTArpZaNa/C6Vylp8zyJi1Sv2GZHTNrvjhWvniK CuS3gAwHX9EaUzmdEkZrh+q47BW8x6M= 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 Cc: linux-kernel@vger.kernel.org, alsa-devel@alsa-project.org 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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749630022272864263?= X-GMAIL-MSGID: =?utf-8?q?1749630022272864263?= 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: 20723 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp3104690wru; Tue, 15 Nov 2022 21:39:22 -0800 (PST) X-Google-Smtp-Source: AA0mqf74+n62GRLBA4Phj+Hh1Dvus/Y+P/FuP0XdvOT8VSm5RWWxdA+8o0w7J4hr1xLNevhbYa25 X-Received: by 2002:a63:1e5b:0:b0:476:d5be:4511 with SMTP id p27-20020a631e5b000000b00476d5be4511mr3728887pgm.139.1668577162536; Tue, 15 Nov 2022 21:39:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668577162; cv=none; d=google.com; s=arc-20160816; b=HUabHFSGzN71ttR6Vn4a0v0U9Pjgmd+SqHsY6dLW5XabyY8yRPFLkkAxxa3+Us1/g8 d+4BIeWjTZ36Kl+d2wCAqxOjGFV9mgjn6xX9k8lFiv3R5/Y5D+kOO9mfd/1cp3nBcIjN qRUKw/CMTbd+i2Ue2WWY0zJ7xLxyFUjI9tk2wENRvXmy9rSST0ZLdGx218tclts8fNBR kIktYkX8Pmp9VsYxkUjaXNS//l1G9GXzjFOVUT+Y0JwtrumJLo6J2bnJs1vBmCRieX2V rR0nnIItg7s54mfA6UN2N+Yzs/E5zL46bAxKu3dFhJNX1sQwxPYGtCIhLNU/BqmfeiDO ommg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=2R6sweEIHhhYpgiaCutH/nTdz9vJpXVC7DNsSKyfy1o=; b=vwTyC4HwJvX30B/lL4IdIZytBpHKEPTg8Z5ilEFa8V8N40Qbbp3zx/ZgXeI8fR+KHa BxXYAQjO4ylapWmyDwAI13LNQjygqrosZOd8/+dM1FmMPRNYOfk/al7c/snHkeQt75jh t1COn91/o3osWIbYjBJXTZ9sl7yjkSjVeRsp1S6q7agy9ddg19pnpmM7HJHRLTc7Pok0 +xuOjNWkQyqk8GqiLG2n2ufAcw05Qt/REB40WUYCCCfFha1Vge6DnUcMVnxhI/NAqMk/ UYQlCYxAEGPrh9ndsXbNr5ljv1fEWXxFGHj6xiezA+md/6pN0otRsf7N8lCDxZTinGw/ pnFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=SGFwQZrp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y10-20020a17090322ca00b00186e114bedfsi15963539plg.126.2022.11.15.21.39.05; Tue, 15 Nov 2022 21:39:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=SGFwQZrp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231702AbiKPFii (ORCPT + 99 others); Wed, 16 Nov 2022 00:38:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54092 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231657AbiKPFi1 (ORCPT ); Wed, 16 Nov 2022 00:38:27 -0500 Received: from mail-pj1-x102a.google.com (mail-pj1-x102a.google.com [IPv6:2607:f8b0:4864:20::102a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 875DEB76 for ; Tue, 15 Nov 2022 21:38:26 -0800 (PST) Received: by mail-pj1-x102a.google.com with SMTP id b1-20020a17090a7ac100b00213fde52d49so1351272pjl.3 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=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=0rq1cok1rI64Or4Ur28PWTuUm9vQxzgeRCDEQ1GD0DSLJ7qoUzcRwQPdV117UEvfRs MmTAbEmohBq9j715VR6JF0luWTd/XU7aLgyOh9GgUm3dFDPXHRran/aQIG4zgyoMbpow P7bD4QD+9OMRsAo050JdUbi06aNOzzj2xzg9z3kG7tKtkRCdjIeIhZ6KM5J9k9CAIlQ5 j0SIOvmvMFhVh24j8rcaA51XZl3C2GRSOPnHD7gZTkMpYtdKIc/K3JIgLwbbz6uhpTMT 4vOIIK9ECCDg3SeHuyxsYjVsz9PDU0FpbjWf+kI9CHKCUFX7MFrg4QYxqCjcn1OeoK0Y MfCw== X-Gm-Message-State: ANoB5pkc3yPnP5X6sI8iSbUHZQj7zqTuGUwt9TiZG0P+7Cyf1jMmCFWa aU/AIOI77bvu1Q0GGVNe6h8= 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 Cc: linux-kernel@vger.kernel.org, alsa-devel@alsa-project.org 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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749629966672106937?= X-GMAIL-MSGID: =?utf-8?q?1749629966672106937?= 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: 20724 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp3104703wru; Tue, 15 Nov 2022 21:39:30 -0800 (PST) X-Google-Smtp-Source: AA0mqf665QSuSIdkUOQOtitS20zZGG+kmBqomscwjudtzvps+Ocr5tS7/DzoHUPON2gvCyv8SUGV X-Received: by 2002:a17:902:edc3:b0:174:af35:4b90 with SMTP id q3-20020a170902edc300b00174af354b90mr7466476plk.8.1668577169726; Tue, 15 Nov 2022 21:39:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668577169; cv=none; d=google.com; s=arc-20160816; b=RL4sBRtixnqp1z3+YzLrdFri4HzWi+CF1FZaN51iTHjjk244G/nD60VoXXANE4vMYz LCtkfbKuMeCeLohJQ/cOlS0wJqlBM3XJejBtyopwm01DH43kQ2XYI0uVSqcEXtvjUlw9 J0gawVnI2jt3byolGs6Mz7T+9bpJnZm0LN33su77H37GeBTxy4YO7+VKg/z3Ub/Uy156 Y4ysAZMs1OYfNfKq+Kgp27i8K0F5BQeKgQQ0DO2Hn+uEu08jK3SmVxah9vZw5yF0p4Kr 7lPU9Levscyu1e1fT5z6inTlaNTMKAFMTmo8ZK7GuRnQGjoevWVGvWwg8+DA/gEHUGS2 eRrA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=sFQW6v1diH1VyW+sL8lBdAoomh7zxMpXfwnkxl/32zA=; b=Xbn3cfRkQTxm4/vkwFMZSX/hjbMed5dB0jfFgC8thmS+iiKXHrvmMshAhveb+rlVkq 0AGQFOVSqxuSo/FkbrhWPTgL/jPKhklohtlxlPTi4JIKX2p4a9il5jz/NVCzuJL+6M3N EQWRWxTabd8cvqBscCUNSunDrc7QVxETSfXx/KyZGh/0/BtNxQGXcdXVWF3GN/1E2aZm y8lw0jNqoRv2ssjcHakbYa9Hsy7YJO5DGSoC6kUdEEr4WeZ9v2gJfcRKHM4KBntjejby xgxe29czsqo+prNe/jX9j3Du2wNrBm5uOeb12hZPtwYIEM7kSEVdr+r8dqyTHBljXITQ bHlg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=naf7hHO3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p4-20020a637f44000000b00470693437b8si15420094pgn.550.2022.11.15.21.39.15; Tue, 15 Nov 2022 21:39:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=naf7hHO3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231801AbiKPFiq (ORCPT + 99 others); Wed, 16 Nov 2022 00:38:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54080 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230343AbiKPFi3 (ORCPT ); Wed, 16 Nov 2022 00:38:29 -0500 Received: from mail-pj1-x1034.google.com (mail-pj1-x1034.google.com [IPv6:2607:f8b0:4864:20::1034]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8FB151025 for ; Tue, 15 Nov 2022 21:38:28 -0800 (PST) Received: by mail-pj1-x1034.google.com with SMTP id gw22so15564851pjb.3 for ; Tue, 15 Nov 2022 21:38:28 -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=eTujegalUN94Owi/VeROpFV8483WUVr6PXo0zKVDRtTAnZs+pVTZt3q4fOhbrLlWWn wPl81HOl88eArrEocwkbAOoD2ANXpE5r/v1C0jgvMs9E8Bjau9dZhmsU576JUeHi4Riz N4MGp/2Umjp9sYxlZyIxsb+YnuGDCuR91WWMjwIRq1NXtwzPtx89ciGCFgj2yxBMNFBi 96W5pHIEUphMQ3iY9p2dfueEWn41FziwCeZ1/RJM3IJcuJgbuCmVG2oAUVkqsHEepX79 AD1APByJKf5uV5N4unkIK6MVIl4SJrOehOxW9D01KrYwfNtHoPHP+1eKbNPeze+lyCoo spLw== X-Gm-Message-State: ANoB5pmDmf6jf9wFqNfynyeVUH2AGfbwbzDmIc2TXd4OJvOY2zaJGo/o uVnPMfQRa9FG26nBP/zIbwE= 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 Cc: linux-kernel@vger.kernel.org, alsa-devel@alsa-project.org 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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749629974140946331?= X-GMAIL-MSGID: =?utf-8?q?1749629974140946331?= 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: 20726 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp3104780wru; Tue, 15 Nov 2022 21:39:45 -0800 (PST) X-Google-Smtp-Source: AA0mqf5ZMdIRL0OhnrffKY2sxOPx0UvPsFY0oEnBpc5NaiHugX7+clyVCYGgmWadj5UEghexaKD9 X-Received: by 2002:a62:e412:0:b0:56d:a1fc:7000 with SMTP id r18-20020a62e412000000b0056da1fc7000mr21322016pfh.35.1668577184884; Tue, 15 Nov 2022 21:39:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668577184; cv=none; d=google.com; s=arc-20160816; b=fikOxDQc/7O/e0mjNkmwV0P1YA9zDjnCqK9n7VUhoUoft0AzWgNLqGyJZCyjTo1yOS qUevx8d58SUM3gTLKedWb7aUeZVYzhC5XTMEHviWfmdb6Oy6uOPBcpM1Qw8+BQrdY5iw WlKLJz0AJllGUN0PIk6OVbDOlnCsIdZ1UMxJh74aFYiYfUPe07ORBuvvik2EQph/V0x3 VaEbwCNxz6zoKAxfiEsxLMogG1r0MCBRsYQbTTyCDdZ1zbHHKhvGgQbslUcQUhElDl1C CzVyZj9r3ZZut62ZQHyWLJkjLgAUe4uMrS7Lmhnqig6Roz1612RNIgbJHbQOzllxWsq2 tgQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=r01ypcYo+LtD9fhypz7U4KPnsRobXTNuGoo4vyNF/vc=; b=xdaQ7B13p0/j65OCa+aznBSmPd8Cw8C9jsJR6ByZjDbkDgys9iD6OjGpxJWvnvEVaF W3am3+sve03HCL+/uCRze2uwbi58zrVXPMXitjD78hqeh777gQVIS6N75DNVYy2hVM/a C5YgetPPyVWO1veMRu1sHetGCZNfdcwu4UCsGMTwNAmYhopAdWR58qN8MBGsHeQULDjx Sq5RCZQSDmXQhIVWM6tYCTX6kcfesFCbywUrD5WIaeObVm/gzYSWH2DhFjvmk7gC1nKi J1o5KWjn8bXjZUJiPBLxbsOvpO+igiwiGntV1oJblscgVne8p9jhCKtlj6x3k6Uer+LK rcig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Hdfcb6sJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r191-20020a632bc8000000b00476ceab2adcsi3093233pgr.448.2022.11.15.21.39.31; Tue, 15 Nov 2022 21:39:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Hdfcb6sJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231878AbiKPFiu (ORCPT + 99 others); Wed, 16 Nov 2022 00:38:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54088 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231668AbiKPFid (ORCPT ); Wed, 16 Nov 2022 00:38:33 -0500 Received: from mail-pl1-x636.google.com (mail-pl1-x636.google.com [IPv6:2607:f8b0:4864:20::636]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 393FA100B for ; Tue, 15 Nov 2022 21:38:30 -0800 (PST) Received: by mail-pl1-x636.google.com with SMTP id c2so15427937plz.11 for ; Tue, 15 Nov 2022 21:38:30 -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=V4NOJNrxECk87eZ9Wm9hdgy2+dGEke6DaxeVSbI2WgHVhsuwQAdQztj2iEytnlQH2W 4WKoscdGxkAA6HXfEnF8UftEdw//9Y2dWZsyxorGdTfGpWbFKk0ShRrWHaFziRU4MW5V K3GNH3WxkLjAE+I5jeLaD6tescLjxZJ7kTLngI99CnAb9ZvfZWUxEt3mbDMSIZ1xjb6L va3pFBaHKoOFEt1+XxzaL8lbPU186v2CwpbU2d/4nXslQXW81YtX/q9AKH0wc5btfBIL QP/1ezxkDGBXzQcyRxhYxGi7/FYfMEWpq0EiTlvrPa1B4K+Ulr2e7HBEGqBBfisVZVE8 OvUw== X-Gm-Message-State: ANoB5pmAx+xKG8o0XGDRrGAJlOAaXp0/5yh9cHR8N/S6qL/ygRuWsz6t z5pYGqFDP9oxQPgZIV6jZA0= 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 Cc: linux-kernel@vger.kernel.org, alsa-devel@alsa-project.org 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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749629990175240909?= X-GMAIL-MSGID: =?utf-8?q?1749629990175240909?= 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: 20725 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp3104742wru; Tue, 15 Nov 2022 21:39:36 -0800 (PST) X-Google-Smtp-Source: AA0mqf7goY3d4ijfqY+4TjzlXpGRWI4NlDNcKLGcJHb7SOCILsh1jAAKVoGyN2Fqjgf3f7LCEHkN X-Received: by 2002:a17:902:aa0a:b0:186:944a:2560 with SMTP id be10-20020a170902aa0a00b00186944a2560mr7552574plb.84.1668577175847; Tue, 15 Nov 2022 21:39:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668577175; cv=none; d=google.com; s=arc-20160816; b=Ajf65I3937B7v74onLlWUOMp1zzzPoHxLZucur59zoSr4r7pRl0vomU5V4a1RflwVP AWaJGaWf6Cu1Sjaruno64+g9gGYeq+G0Jw3b6+2uE8hssl7TEkLncmdmONO096YRcP+v /YAscHIJQpGVAptzPC/vo+uYjlF4DkWkK57QU6QQRJ4oRM6J3EtOeIQDpG+VkF7jy2rs AHFeRBuAzjSowR3XBCBXrZHDTd2hVrAJbcap0/hEv+xtO/1otOWHxjoBxzYaSdX9qCEm 0AjFzQA+w+Q+3HwWeI/Qec2ve+wv/txsu+BaooJ+ruxUDSWMnIaeNG8J5fZwRqdCwhQ+ H7hA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=xwwwsx9jfrJYamHfIH6HX3vvIu1imMZZ+4VMVekHngI=; b=gg4PoKLFI90C+Se8QiY6NCTLfTqINWiN8ozM4q88M+mQOK/G6qi87Hh2QyGiPZ4LAv oqxhJ3ZIC4CBpuHjetj+Bo7VtiSHfc8CAKOPZnx+oZ3X8t3VpRDxsWSi59Xha5kDWGk4 uvcsjHTrB3NHqwvqiwCCJErO2UGKuSfInKu+z7XN926uOEajju5j6xL9cfzjTMwkTeYr h5MCJ7HlZXbripYLzhj+v1EqbGPCYYXYnMPnxk0+HDrPGnb6q+mKlrtSfvDL+wRJsWh6 nnMxvh4SXTm53QQfTR9Wnjgc/d1/3qyqH26DUFH/iltG8Ldd8o4SFUmUI/C7XS/ZQOXH fGAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="Rz/H6Ys2"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s42-20020a056a0017aa00b0056cb4662b9csi15663697pfg.16.2022.11.15.21.39.22; Tue, 15 Nov 2022 21:39:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="Rz/H6Ys2"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231989AbiKPFiz (ORCPT + 99 others); Wed, 16 Nov 2022 00:38:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54232 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231688AbiKPFid (ORCPT ); Wed, 16 Nov 2022 00:38:33 -0500 Received: from mail-pl1-x635.google.com (mail-pl1-x635.google.com [IPv6:2607:f8b0:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 62B656255 for ; Tue, 15 Nov 2022 21:38:32 -0800 (PST) Received: by mail-pl1-x635.google.com with SMTP id v17so15469340plo.1 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=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=LBDnCoDACPoZB5d+ACUbvg9I/hVivT5zVuu25m1UPriqzPZs+E/4XF3Mx2lzLY/gah kPjIroAQ4+S8ndUQP6yn6jIGT05F6glZis7CqhEGgNgjUQtYl5QzW/kvdJNVbgDh0JBE eddsFh7rtM3Ia8lGjorc6V/FYLd6xH4lKII2ubmjFpomhCcMZfHVsRY2I+jOlTlcN77M fx+tUhboGS7+OdKJ7/SeTx3bf3AtRglFeBoS6ffo02drTfq8DiwVJ+UneqsL8EWd5NdZ GRfFA9h8M/EF/Nf1YQycwgh7LxPoqyzDmqtUxG9l60UjBidhpCZyjZADGqbTcMkfcFgD ooUA== X-Gm-Message-State: ANoB5pnNj/d6CfnkcxG+rEgxe1N1hN8w6ynSRQHvjCri5YR2EdoVMgVi MoLojBQEyL/Tud0NGaLyMMM= 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 Cc: linux-kernel@vger.kernel.org, alsa-devel@alsa-project.org 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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749629980744225688?= X-GMAIL-MSGID: =?utf-8?q?1749629980744225688?= 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: 20727 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp3104851wru; Tue, 15 Nov 2022 21:40:01 -0800 (PST) X-Google-Smtp-Source: AA0mqf6ZTuT740xs505egRd5+JvOuMp5oonXOmcHG5d7m/HeWFQyBLcZpXKeQEJbWvVtfUpb+5p5 X-Received: by 2002:a17:90a:a4f:b0:212:fd85:2655 with SMTP id o73-20020a17090a0a4f00b00212fd852655mr2044444pjo.162.1668577201309; Tue, 15 Nov 2022 21:40:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668577201; cv=none; d=google.com; s=arc-20160816; b=raMLKKWGW2E9yvkVZ8wAsBBqa6atqJ273wNf3hmJVjU6Z+MTVRDLrzD8DM+Buq7PFX EUofGKBBFIBnP3xgfQdgiMN46CfVDA5GZ6UP86t5ghlhkzdL4qwlkZrmwr51w/rzXCKX /53jSq+w0tFxMhHoB9j817U0gCyxcWkHD8UabkMeVqaJfQM3khF/VigioMS0yzZ2FDva 1KcENVf+gHWnxt5O5zKXIPfTDrGS/z3VAMMzXIt/oTsrz4i/lZN32YBIJ4b9DtmF2RjW SxeET9+ll562owak2KVhy2YzNpvNsWydOIEXCjdDx2gbEoBykGUOuJPN57O80bxYj8jJ kpbg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ULkwCXln6lxM8XLag0GHNaSgcab1VgWTlrPLPEn1RmQ=; b=p1MeeF+R76W7V9YduksT6fVHaxBV1zRr6UxMrE3xtlFqtsixx2Oz4nX/tluLQFpWYZ SkeNC38BKrFxxHR8PUT8O4cLobHhT+LVCfWzbKLCj/wPeCmfP0DBAK3QHLhjIJ8MUMGg UBLIsoQ5jKAykU75QvDmMpek1nrDusOzjPlEKgotwz6Hgn8aiw21H5iGIBSnezp1lT+R hRWWTC8V7KVdEhAOQoPIMORPW767MedVnjdZ/jjdtQDSBE3KaXwUNY32VeNzbWd7frDc OkMVppPagsPG0iv5FyArw+q2tdR0tfYkreQ9Q8ZcnEjcgODUlEG+mSHRy63nqZJ1IDZP P7XA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=WKM+2PzQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h6-20020a635306000000b00464748b58c7si14469626pgb.838.2022.11.15.21.39.48; Tue, 15 Nov 2022 21:40:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=WKM+2PzQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232027AbiKPFi7 (ORCPT + 99 others); Wed, 16 Nov 2022 00:38:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54080 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231710AbiKPFie (ORCPT ); Wed, 16 Nov 2022 00:38:34 -0500 Received: from mail-pj1-x1030.google.com (mail-pj1-x1030.google.com [IPv6:2607:f8b0:4864:20::1030]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D016A1025 for ; Tue, 15 Nov 2022 21:38:33 -0800 (PST) Received: by mail-pj1-x1030.google.com with SMTP id q1-20020a17090a750100b002139ec1e999so1363862pjk.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=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=mbcAZtXKAUeKWonoeHPZqKRDX1oCJxwY2C2TqJN495F6KVudFKL3uEcQSEJbyzvnP2 WtzSOLjqbusvgnuxUeQRhVa2fwZy4ZNha+ANC7sX3BDj/hlhyu1lsHkaJ2LGem20ttpl ah3uHTQFRRgnZMoMZY61JatMvW/mHfpjumLQtpCjl6pcpF+2kSA+2NABRU3w/AQHvP6N TgstspRuD8jJ7fP/EUcOhueQ3zrWJK930SRiGdLuo6ldDzDAns+zmoW16+A/LVyThEI4 koDNKHYkOG24x/DKFPT7DgUt00dTobpSUund3ZhgZQeekbrESz4fAHuSEzw7ylA1r0kU HIjw== X-Gm-Message-State: ANoB5pkCWmUP4ZxX9CQmPqf80y/ioef8raQNMNONJcfy8dsYaCsa5O7j srJ6h5yLBZBEs64TafqsvKE= 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 Cc: linux-kernel@vger.kernel.org, alsa-devel@alsa-project.org 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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749630007649701775?= X-GMAIL-MSGID: =?utf-8?q?1749630007649701775?= 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: 20731 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp3108162wru; Tue, 15 Nov 2022 21:52:26 -0800 (PST) X-Google-Smtp-Source: AA0mqf5/uYWKgPSBALCpQK1cvyQVhPSQ2VedfvjQ7AIxEgcPDUwIdZkiFmtsAAKfsBQA0AbjYXCr X-Received: by 2002:a17:902:9a48:b0:186:6381:f180 with SMTP id x8-20020a1709029a4800b001866381f180mr7641602plv.100.1668577946235; Tue, 15 Nov 2022 21:52:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668577946; cv=none; d=google.com; s=arc-20160816; b=x4c9bFk29lIw2uJO6J+zT4Q33LANb9yBFw9Addvdri8lxpscWaK+YTyx7onlyQ1l5S d596rwrXyx1qvollRBaoz0AFlSlEHRY3bmuiKb6AFGYa2eWv1oI8ZZM+EUabxutL17gk YBhDbHtaZQ7iRJZCPMmyKe3E3OoUFOXmOM+5EmG7AbBoJrMZlqtLjRMmouFLCDkbahlP kxgp+c1OdqmTyzETu3AGR34rWDpEvurDgik6MHEz7TPR2NCIKAQvljP8Pn1sgmuk0P01 z1wg9gA1P891iJtLz8QEoBDwDWQ/I5Gvfm7CDLu2WFvPY8+J+AyoxfQww/42iHwalFH5 7+Yg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=PI/Dm8Xn6WniktdX7f/nHoTvWtwHm/H0w1CeN5e56Wg=; b=XkcjJCH45YtHvpGM6eCdKSTVXmYjKMjxDqa9xvSH5V9Kc2PDuqSKzhIAuwo/Qc3NgU cJDtRmEVJSPWL09k3HrbsMIBHqdqawNG9MoLYbUA3QbCVrAXzS0A4YLASc6hVozfABRY 2K0gNKTwwZ2wOP205rPzsT+vEUAv4fw5pwpmk5xMPc9mFrP0CCcsfXOM8tx+HXq1EY09 y4+QITG+eql0TDJmuMg3SoizxJ2U384Lr0y5h9zUPOCeR1Guyj5G+0HnTjyYxkxR+Pw1 KB4SkCspjgWmJyyf/Cj5zmgFRdMCMfhJ4/VOHZKeR3gAfN1xXWp6WWlzTbPkUTuQ8Vi8 /3WA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=FdiOzIGo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ls9-20020a17090b350900b00213b3144671si1376524pjb.0.2022.11.15.21.52.00; Tue, 15 Nov 2022 21:52:26 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=FdiOzIGo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232055AbiKPFjF (ORCPT + 99 others); Wed, 16 Nov 2022 00:39:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54296 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231766AbiKPFih (ORCPT ); Wed, 16 Nov 2022 00:38:37 -0500 Received: from mail-pg1-x535.google.com (mail-pg1-x535.google.com [IPv6:2607:f8b0:4864:20::535]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E764E60C8 for ; Tue, 15 Nov 2022 21:38:35 -0800 (PST) Received: by mail-pg1-x535.google.com with SMTP id 136so15703614pga.1 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=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=GSo+89SFm9HKo/snchjojG3JiTcuIGMBWIxbkv+kYzG2ACBLdGMnMK2CZNt2+lvp1/ +FuAXyE6FC8GZxd7QnL3K3UQYfGZqgSE8yy8SmCMHYT5mX5wnB+xjwrWvhMutflJB9PA mUJkqXWcDQliiy+nzbDL/FRFczJaA2F7pS+m+lq4ZPyjSv2T5cwSEGsDL+igFNBFgtnk nbzPo4rtuP/j84m1ipye5ZfTHo2jxzDNvIMzW+F3vWuUy0+xKNRjHJSXB368jD+0foBi qUb5YEOl9Nt6zj6GvwXJXFgSThqQMD7VyS7gP2jGFicw4+xeSkEqYPfZCIgAKNj40x0B Mgow== X-Gm-Message-State: ANoB5pn7bgM7McPG2AIWtYWA6X2A4hJUiOjhUiaM4WIMG4pHfhlmp6kN 9ULol+RUwuIcf12XwnL33R4= 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 Cc: linux-kernel@vger.kernel.org, alsa-devel@alsa-project.org, Rob Herring , Krzysztof Kozlowski , Krzysztof Kozlowski 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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749630788877827274?= X-GMAIL-MSGID: =?utf-8?q?1749630788877827274?= 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: 20729 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp3106758wru; Tue, 15 Nov 2022 21:46:36 -0800 (PST) X-Google-Smtp-Source: AA0mqf6tkHOKUgvhIZ8w7IezDgkiKlOwP+HJvcxPPbni4+McVP0ghI8Wl0cKMT+hxdmNPSV4W1KJ X-Received: by 2002:a17:90a:b392:b0:212:de1a:355b with SMTP id e18-20020a17090ab39200b00212de1a355bmr2161541pjr.1.1668577596400; Tue, 15 Nov 2022 21:46:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668577596; cv=none; d=google.com; s=arc-20160816; b=H1aK7nFVtvK2aQBjgEfwqKYELHrlYqpVX7rgKfb1nXUEt2GJoOWx8cw6jqJyLS7kQ4 keAsdjIHL8OY7Lp41+R2XEso0+RdRUXQFQnSfi2k/hk4UNtyTiGxEf87Fnsthdznh/Wk ZvNTCgFoidbpgV0C3JSR0Ozw7ywPyYZnZk/bUcyvlppHWswkUMhZ+huTVfEOXaJNf/EU sFr+XEHjqb6guAwkwFr+wc/HuLd9NY/Yr8nFndqFTluG8p/pPOqUbSc9sQnifqv6I4wX 8lr9tCuXGVLBmkuAL1045o+x8CsUQOq4eT28VQquxHNzyMxH8xeo1Ope88IcR3WnTgjG jF/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=hTyuvgruJxkGjK2lPmWOPAqXK8rk+Mma5cjclFSB/P4=; b=oDPCz47JBiYbMQNbmDTkDlixlIZWhvs5eArV9QILfcol466SUIwQSMsH3vqOWXsu8i xTh2LlI6QSUM5HgatF+9InN42SojgnGPXxQZT6f4egxKFhhzTVeNTIU7+Tan7AiJL0tw GVGlVGZ+SwJi6BvFbyO/lq9OgXAodovo4pFAIgqeSVjzESMnLY4plqpMkzGLZwwtGx82 eCBTIqhoC71Cop5C8HIkI3Vl4uxhuzA7QsYS0+DC7nlRFf2ksnn6oO5nEO/7zt76bZYd U6pEwr2w9OxbDmKiq+fpO3+bvR18pVH5BkwCuDEFq7Dp5WPlJSlnM+4JbF+OSAbtH+Fq H1Tw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=isKr2CHW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f24-20020a63e318000000b0046fabccb7ffsi14815987pgh.494.2022.11.15.21.45.54; Tue, 15 Nov 2022 21:46:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=isKr2CHW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232075AbiKPFjL (ORCPT + 99 others); Wed, 16 Nov 2022 00:39:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54324 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231686AbiKPFii (ORCPT ); Wed, 16 Nov 2022 00:38:38 -0500 Received: from mail-pj1-x1030.google.com (mail-pj1-x1030.google.com [IPv6:2607:f8b0:4864:20::1030]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DE804AE4B for ; Tue, 15 Nov 2022 21:38:37 -0800 (PST) Received: by mail-pj1-x1030.google.com with SMTP id l6so15599318pjj.0 for ; Tue, 15 Nov 2022 21:38:37 -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=hOqghfS4RAbaxeJo8RSPWEH2uFRoV/fqpkyfivsRhHxWqjqoWL769yPdoB9h+yxaGe UGYb4a5RVZ3OTGoq51/t8AEx9PAB+aKUhTFcvXK6bMlBjVTx/o/Sfhfl3/HkCkijpfmu QcZoyjhuLUS1A6HfaQkDozO4PipFsO1Wfk5h0K0l73ZOcGg+HQky53A7wKW/V8McaL6c QoWdUV/Lqhd2Yy9h9Q1fFbiUSeoptWcpFMQVjMIJBQcV1I7JUys5Xskg9bmVYwyn8OR7 dIMA5A1JO9Et9Uxfi0rSU/L1jLKatBgbMEp1GsUoS4BPb82dNkBXE1bVPve7TXQpSpEG IvgQ== X-Gm-Message-State: ANoB5pk9C8TSpxaunSY3NTWmVva8hI4+TtTZa+KiF9tfJL1T3AXuG9LY rWetO+C/A0zdWpVbSFDIfWfcVoEsXXY= 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 Cc: linux-kernel@vger.kernel.org, alsa-devel@alsa-project.org 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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749630421492091985?= X-GMAIL-MSGID: =?utf-8?q?1749630421492091985?= 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: 20730 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp3107621wru; Tue, 15 Nov 2022 21:49:59 -0800 (PST) X-Google-Smtp-Source: AA0mqf6xbND6mcombwjBJ5WM7t/oppsWT3JLNuAXAWNyaJsahddaVbTREOUBP88qnUgeoMwhPdOJ X-Received: by 2002:a17:90a:1101:b0:213:625e:896b with SMTP id d1-20020a17090a110100b00213625e896bmr1990069pja.175.1668577799319; Tue, 15 Nov 2022 21:49:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668577799; cv=none; d=google.com; s=arc-20160816; b=frj+ZtxOwzl6hVeTGCuil4MeEr4GfGc5k8WycCUQ7cSevgg8dnxlhzU7Nj4jscmkcr /aL2BgW4by/O+i3s3c0BiHhXcKffN5syZNRRgs0flDhmDNo941W3XzZd+VOsxdBEFY1B rAT5ZAvjA2ZRf4/vKCT5rAVtWAJbq6Jti59ibMRwer1EQHC7V80GmFd+ty+ofeiIZ3hY OuQFhuIiansWxz7wg3b4R32/Mds4PdDsGdH6fuT1s0xUG5Io8JmV8B+0G7ANchvD8CTR uG1JAhOtAXV0UwgQz00FXh/+Gc5sSKYVUzHXk9dEu46aHNUmydfLnAlE6oMvjUBRiutM Gztg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=4MEFKtk2jr+pIrd01Y8QsB7lxnOrOB6iK6YPYP1nPMA=; b=rzSopxhLGPDB8emapNMMI8usT1WuemMLU7QBc/VQV0fdiBwTmVfrqtW2JaV0zq4nwC zmKUfNvYMqIg9z1C/qEQXU9lz4sCr/fSQp8FR0qamZArEKwz9xlcU3/gsoDRaa1qEiTr 3g+HaqoV0iqCS4zqQumbpYGSU/94SiqOnhZY7eUGH2JZpC1SEKsRXLZw088su3Szp2rl K5YP5C6TQFFggJ81SSh/K26nGFoOlUSkkOuSxz0FJxGYxNECWLMmByXISbh+SC4okEFe fe8Y8ozJKVQgiXgZUnHFYkfnUs/UcyTVKfenBWbHtbjmR6tQt20ksocwElOOfDINcvm9 pBfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=ZRenwPio; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u191-20020a6385c8000000b00476f0b7d1f1si138027pgd.804.2022.11.15.21.49.44; Tue, 15 Nov 2022 21:49:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=ZRenwPio; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232099AbiKPFjP (ORCPT + 99 others); Wed, 16 Nov 2022 00:39:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54324 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231802AbiKPFil (ORCPT ); Wed, 16 Nov 2022 00:38:41 -0500 Received: from mail-pg1-x530.google.com (mail-pg1-x530.google.com [IPv6:2607:f8b0:4864:20::530]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ADBD395AF for ; Tue, 15 Nov 2022 21:38:39 -0800 (PST) Received: by mail-pg1-x530.google.com with SMTP id f3so9277541pgc.2 for ; Tue, 15 Nov 2022 21:38:39 -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=WffjFnbr/4M4G2JQT4coB9Ou6Nr6YT35L2VhmciRyVdyVBEewAg//kUHwtgpgx/9t/ LbQGIuvqaUvsmxh7vfTkf1nhqz81eFZXyz7/1z4NYTNZd2MHkgiCnGFPajJ64z6DRMpX zb+IJzRWGJNV6OKsXNNCOMTnDwOVjS89wXesb+pThbLtzYhjHXvWxmjMVMspcMn4TWUS vwu2Ueo5RNSzbDCt1p7GA0anNaIOtrtBjz3fZ9rbhv04hUUth8enY72RN2qhwf/BOVGt SdtzMsmdBPylmilBNiijI+CH/bpTLTgS/w/O1ed2/73yw4aI8Q+F9Kt3NDrAuTMpcEVK 0UuA== X-Gm-Message-State: ANoB5plrrbEGL58O9kGqvPWAR6c+O1TUq8w2Pf9OBby75DxOn9yDla3/ XoznDeH77805l1vkdgAyX44= 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 Cc: linux-kernel@vger.kernel.org, alsa-devel@alsa-project.org, Rob Herring , Krzysztof Kozlowski , Krzysztof Kozlowski 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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749630634733427816?= X-GMAIL-MSGID: =?utf-8?q?1749630634733427816?= 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: 20732 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp3108933wru; Tue, 15 Nov 2022 21:55:23 -0800 (PST) X-Google-Smtp-Source: AA0mqf5cnTeYI/1jTKJOOhg5dX3d0bRxQg7wIVskAzfYjjJjnbP4VIS/DIWbl/RID8zXeUpp6+DV X-Received: by 2002:aa7:8759:0:b0:56b:a795:e99c with SMTP id g25-20020aa78759000000b0056ba795e99cmr21890863pfo.14.1668578123604; Tue, 15 Nov 2022 21:55:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668578123; cv=none; d=google.com; s=arc-20160816; b=ev9rdeV0e4UW43OgM7bvu1nfyYSHWSdwaTOcGtrqMj/wf28uTcdq44J8yhU7KoRmrD FUO095dqsm3TYXGxIexJM+MDp9j00+6cZ1GYOKyylVSvv+6ZwgCT187ggikvKK9UgaZK XNuVgZLrOXlqiStQQCXzuKcR/1js6hjIqPFEZoRvd2bgNRpNMgQyqLIJrO7A5UJjazM1 xLW4P9THw87GpEJjw8HtpO43xLesCOVLTxZZWfTy4jLDc/s+7fS4GFt0tawGGq9Dp80s 2CCXFbfk3BCwKtUgKnqQd2aPy0BUpKPSHn59X5oKtoeN1ijcGZlQ27HTQTMyC0fyh7kS BmYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=v1IwnG/hkjmxOvKDimBi/CuJjoVrJcOnhShxdmIQmZM=; b=Xizd+UsTApV2ORwViDBZ+alSqQsZhdcbsicqnIEJo9EJKS5ZwViV40g/I2N9r3LLNZ ijAAeiKLFVexn0eSUvxbaL4TQ73+EyBihugM8oRab+9HITulLtvJ/vRomm4tvylErx6J p+o0eoZKSp6sG+tPP8ycHptDk+5zDCW0/ygzxbLY2leqgQcusMcTlqL9NcDQsPQoATXK OR/6HvfwC6W3WVd4MNMUoPa+yduqqpXd0VTLcDKqjuEE+0HWZoJY2rEgEmeLQIG7o9Ss QzZdC2GAMkqxQKhQNTPqvJ89tYAgx6nin6yWsDs1TuNyll1+vWS+xAgsLwABBtUOWr1x 6YzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=AJH+sKrg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id pj8-20020a17090b4f4800b0021308f24606si1089945pjb.123.2022.11.15.21.55.09; Tue, 15 Nov 2022 21:55:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=AJH+sKrg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231977AbiKPFjV (ORCPT + 99 others); Wed, 16 Nov 2022 00:39:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54526 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231849AbiKPFip (ORCPT ); Wed, 16 Nov 2022 00:38:45 -0500 Received: from mail-pg1-x534.google.com (mail-pg1-x534.google.com [IPv6:2607:f8b0:4864:20::534]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 88DE42F3B1 for ; Tue, 15 Nov 2022 21:38:41 -0800 (PST) Received: by mail-pg1-x534.google.com with SMTP id 6so15679745pgm.6 for ; Tue, 15 Nov 2022 21:38:41 -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=YdEjACWvfdjkHeA7hATbgEc4BlDV3t213PXDs9Dp1AnGhmgJwu+1e5F4hc1bpOVDBJ UC0vQNgnVy+COosFUR3xf3Kc9ERVcPTcxhU7ufUaBEqomBk/Z5X0p+N0/L/4fY6e54b5 jyu0dBxzP/DtlXU3vEh64p+VJ/LWLRSWwgNkzGk+hsV7vW+mMFcUBkJ8w2fT1gXVwwnB up7kaMY6f8b4ce3B9LselOOMaVo/oNeGXgF/remuRMqvB0CTcqTEdGfVafKvCwMuOQVA gBUz0/kUUlwOLigojDzY8u8qb+c1g5FCmcdnJ1mAQC1XooiZT7bGqb64RljQ42M5W7F0 UupQ== X-Gm-Message-State: ANoB5pmldAtAMULd4TXPVQSU4RUptdMn9PDQgYOP8CA200ixCHxTo4TA K5WvGp3xPVftgkeTY7ZgF9S3CD0ntqw= 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 Cc: linux-kernel@vger.kernel.org, alsa-devel@alsa-project.org 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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749630974439629095?= X-GMAIL-MSGID: =?utf-8?q?1749630974439629095?= 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;