From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A6A97C433FE for ; Wed, 4 May 2022 21:59:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378932AbiEDWDW (ORCPT ); Wed, 4 May 2022 18:03:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55700 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238348AbiEDWDV (ORCPT ); Wed, 4 May 2022 18:03:21 -0400 Received: from mail-yb1-xb2b.google.com (mail-yb1-xb2b.google.com [IPv6:2607:f8b0:4864:20::b2b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3B48C4CD5A for ; Wed, 4 May 2022 14:59:43 -0700 (PDT) Received: by mail-yb1-xb2b.google.com with SMTP id y2so4692323ybi.7 for ; Wed, 04 May 2022 14:59:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=rmJxiEP7m5MkHAr9riUqfx3uT8FiWx1lLvenswbOwJo=; b=QoiC7QZe2hJyujp1ZRg0nlXjXopykN2j/DeYH65TBWATXUktJf0x/kyffuuacsI/Xo 3U/WGyV+fixlajIQ09GKt1DZZYpxMas0dWaDYCL8jonCJtMRr4CSZtyBZVh8caz3Zhfm KLVYZqsNmH6MjXnLA95998XCfsQEg4LoRnNmHuqp/sQ2AApgVFWMqqZBdroSiC1gbSmN F4COMU/J9YGu52LHRSSP9wDA3f+g3bnizNxpCHxuTE9h/gJ7KhKhsdH72IujMMikVg4I fP3vyeXEvVrVnkAX/oRVPo4TmV6M5W4ptTtqSYXWLDxsKe5hoIl7+BOBmDpgqE7s/ubD 8xlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=rmJxiEP7m5MkHAr9riUqfx3uT8FiWx1lLvenswbOwJo=; b=bb26yNqHQScVNQrGhiUePhNXXhY0wGrJ790BZWanffO8z5E948K3dCufiDjyjTjPL7 cX9HGZ9/xsOahrE8ON+/DT6EA5GUIzbR3u6M9UZIjt/rlHU9PBNkMfJQTjTuBVIbSz93 eTrtUgYlQvH10f2QVMN/awaT1O6bQrUoxuif2UX8jL3QPsiCcIn/chwj18nLyyJe/m/j EZqTMONiag47ZLlI0+AHCizHCRgGS9FLEPUqN6peBuUsH9KljDWE0999mJOLjzx0kdeu hoJ5S98wI/yNP0TAq2zI2Ug2FN7BVpYSo8e5i+UxMCn+Q6+ZaF/IF4aoHgLvkTVMmdJq zHVw== X-Gm-Message-State: AOAM533+NwMCvZ+PrTeJhJ1zAeCk5McrCKxBmgM2hMC7FReMiiy4wHbu hYU89QEi3WMkEc5n6pXwnogTkanAGTdnmQ7PghbMug== X-Google-Smtp-Source: ABdhPJws0kFu4uk8m+EBRW3/56Ag/4uZ6hdskWay/lA/R4RBYkLUb5oUPb5cyXOdcEWwAD5EvFRWUXI3Mh6lxHFGeY0= X-Received: by 2002:a25:bcc7:0:b0:648:d728:d39 with SMTP id l7-20020a25bcc7000000b00648d7280d39mr19634791ybm.514.1651701582183; Wed, 04 May 2022 14:59:42 -0700 (PDT) MIME-Version: 1.0 References: <20220419163810.2118169-1-arnd@kernel.org> <20220419163810.2118169-19-arnd@kernel.org> In-Reply-To: From: Linus Walleij Date: Wed, 4 May 2022 23:59:30 +0200 Message-ID: Subject: Re: [PATCH 18/48] ARM: pxa: hx4700: use gpio descriptors for audio To: Arnd Bergmann Cc: Robert Jarzmik , Linux ARM , Arnd Bergmann , Daniel Mack , Haojian Zhuang , Marek Vasut , Philipp Zabel , Lubomir Rintel , Paul Parsons , Tomas Cech , Sergey Lapin , Thomas Bogendoerfer , Michael Turquette , Stephen Boyd , "Rafael J. Wysocki" , Viresh Kumar , Dmitry Torokhov , Ulf Hansson , Dominik Brodowski , Helge Deller , Mark Brown , Linux Kernel Mailing List , "open list:BROADCOM NVRAM DRIVER" , IDE-ML , linux-clk , Linux PM list , "open list:HID CORE LAYER" , patches@opensource.cirrus.com, linux-leds@vger.kernel.org, linux-mmc , linux-mtd , linux-rtc@vger.kernel.org, USB list , Linux Fbdev development list , dri-devel , ALSA Development Mailing List Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-leds@vger.kernel.org On Mon, May 2, 2022 at 9:08 AM Arnd Bergmann wrote: > On Sun, May 1, 2022 at 11:41 PM Linus Walleij wrote: > > > > (...) > > > +static struct gpiod_lookup_table hx4700_audio_gpio_table = { > > > + .dev_id = "hx4700-audio", > > > + .table = { > > > + GPIO_LOOKUP("gpio-pxa", GPIO75_HX4700_EARPHONE_nDET, > > > + "earphone-ndet", GPIO_ACTIVE_HIGH), > > > > This looks wrong. The n in nDET in the end of the name of the GPIO line > > means active low does it not? > > > > What I usually do when I see this is to properly set it to > > GPIO_ACTIVE_LOW in the descriptor table, then invert the logic > > where it's getting used. > > > > Also rename to earphone-det instead of -ndet > > Thanks for taking a look! I changed it now, but I don't know if > I got the correct number of inversions in the end. How does this look? Looks wrong, you can just invert the argument to any statement of set_value() after tagging respective line as active low. Then gpilob will do a second inversion. > + GPIO_LOOKUP("gpio-pxa", GPIO75_HX4700_EARPHONE_nDET, > + "earphone-det", GPIO_ACTIVE_LOW), > + GPIO_LOOKUP("gpio-pxa", GPIO107_HX4700_SPK_nSD, > + "spk-sd", GPIO_ACTIVE_LOW), So those two have switched polarity. > @@ -81,14 +79,14 @@ static const struct snd_soc_ops hx4700_ops = { > static int hx4700_spk_power(struct snd_soc_dapm_widget *w, > struct snd_kcontrol *k, int event) > { > - gpio_set_value(GPIO107_HX4700_SPK_nSD, !!SND_SOC_DAPM_EVENT_ON(event)); > + gpiod_set_value(gpiod_spk_sd, !!SND_SOC_DAPM_EVENT_ON(event)); Thus drop one ! in front of the expression, just !SND_SOC_DAPM_EVENT_ON(event) > - gpio_set_value(GPIO92_HX4700_HP_DRIVER, !!SND_SOC_DAPM_EVENT_ON(event)); > + gpiod_set_value(gpiod_hp_driver, !!SND_SOC_DAPM_EVENT_ON(event)); But not this. > + gpiod_spk_sd = devm_gpiod_get(&pdev->dev, "spk-sd", GPIOD_OUT_LOW); These initial values don't seem to be set in the old code you could just use GPIOD_ASIS as flag to make sure the new code behaves the same. Yours, Linus Walleij From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2BC3DC433EF for ; Wed, 4 May 2022 21:59:45 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 59A8610E6AB; Wed, 4 May 2022 21:59:44 +0000 (UTC) Received: from mail-yb1-xb2a.google.com (mail-yb1-xb2a.google.com [IPv6:2607:f8b0:4864:20::b2a]) by gabe.freedesktop.org (Postfix) with ESMTPS id 511AF10E6AB for ; Wed, 4 May 2022 21:59:43 +0000 (UTC) Received: by mail-yb1-xb2a.google.com with SMTP id v59so4676975ybi.12 for ; Wed, 04 May 2022 14:59:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=rmJxiEP7m5MkHAr9riUqfx3uT8FiWx1lLvenswbOwJo=; b=QoiC7QZe2hJyujp1ZRg0nlXjXopykN2j/DeYH65TBWATXUktJf0x/kyffuuacsI/Xo 3U/WGyV+fixlajIQ09GKt1DZZYpxMas0dWaDYCL8jonCJtMRr4CSZtyBZVh8caz3Zhfm KLVYZqsNmH6MjXnLA95998XCfsQEg4LoRnNmHuqp/sQ2AApgVFWMqqZBdroSiC1gbSmN F4COMU/J9YGu52LHRSSP9wDA3f+g3bnizNxpCHxuTE9h/gJ7KhKhsdH72IujMMikVg4I fP3vyeXEvVrVnkAX/oRVPo4TmV6M5W4ptTtqSYXWLDxsKe5hoIl7+BOBmDpgqE7s/ubD 8xlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=rmJxiEP7m5MkHAr9riUqfx3uT8FiWx1lLvenswbOwJo=; b=ubPPrxkL1fpHoFAQuv9GT7AYb63g4Xv4diZRwkhHySx9AeapdDy5+5KmpxZbQDt9xN eYpwtnasdO8dcUzDSFsZ2wwCfYa/ZDAdtJokbRZTQyOLeidDAtmYilIwtM1lOkX2f8gV fk+1497KUdcWXYG82np4AdsI27l4bXjxf+Y9Foip4W01Xm9Pcwa15NwhX219tPFeN5Pk hX5nCswpSnEeEodyPvYXbErZH1wj5pGfAwe/Hq3UROb0/KTbzEAV/7v8x3x5QAH4QDhU rS2ra40gCE7hotjC3AJjYDzyZvOl9jMwboOqQyOERKc+bAz+De19wpp7T6NcZBgsugdT 9DkA== X-Gm-Message-State: AOAM533jP0VB8c5hIgHhpO08gwMmv93TI8JImGi+z/98kkMO6c00PK9h 9Zxsgx0y2ngaJLCtP7BhrHgGtYShQ08EH9lFcnq0hA== X-Google-Smtp-Source: ABdhPJws0kFu4uk8m+EBRW3/56Ag/4uZ6hdskWay/lA/R4RBYkLUb5oUPb5cyXOdcEWwAD5EvFRWUXI3Mh6lxHFGeY0= X-Received: by 2002:a25:bcc7:0:b0:648:d728:d39 with SMTP id l7-20020a25bcc7000000b00648d7280d39mr19634791ybm.514.1651701582183; Wed, 04 May 2022 14:59:42 -0700 (PDT) MIME-Version: 1.0 References: <20220419163810.2118169-1-arnd@kernel.org> <20220419163810.2118169-19-arnd@kernel.org> In-Reply-To: From: Linus Walleij Date: Wed, 4 May 2022 23:59:30 +0200 Message-ID: Subject: Re: [PATCH 18/48] ARM: pxa: hx4700: use gpio descriptors for audio To: Arnd Bergmann Content-Type: text/plain; charset="UTF-8" X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ulf Hansson , USB list , "Rafael J. Wysocki" , Viresh Kumar , Sergey Lapin , Linux Fbdev development list , Dominik Brodowski , "open list:BROADCOM NVRAM DRIVER" , IDE-ML , linux-mtd , Tomas Cech , Robert Jarzmik , linux-clk , linux-leds@vger.kernel.org, linux-rtc@vger.kernel.org, Helge Deller , Marek Vasut , Paul Parsons , Michael Turquette , Arnd Bergmann , Linux PM list , "open list:HID CORE LAYER" , Haojian Zhuang , Lubomir Rintel , Mark Brown , dri-devel , Linux ARM , Thomas Bogendoerfer , Stephen Boyd , patches@opensource.cirrus.com, Dmitry Torokhov , linux-mmc , Linux Kernel Mailing List , ALSA Development Mailing List , Daniel Mack Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On Mon, May 2, 2022 at 9:08 AM Arnd Bergmann wrote: > On Sun, May 1, 2022 at 11:41 PM Linus Walleij wrote: > > > > (...) > > > +static struct gpiod_lookup_table hx4700_audio_gpio_table = { > > > + .dev_id = "hx4700-audio", > > > + .table = { > > > + GPIO_LOOKUP("gpio-pxa", GPIO75_HX4700_EARPHONE_nDET, > > > + "earphone-ndet", GPIO_ACTIVE_HIGH), > > > > This looks wrong. The n in nDET in the end of the name of the GPIO line > > means active low does it not? > > > > What I usually do when I see this is to properly set it to > > GPIO_ACTIVE_LOW in the descriptor table, then invert the logic > > where it's getting used. > > > > Also rename to earphone-det instead of -ndet > > Thanks for taking a look! I changed it now, but I don't know if > I got the correct number of inversions in the end. How does this look? Looks wrong, you can just invert the argument to any statement of set_value() after tagging respective line as active low. Then gpilob will do a second inversion. > + GPIO_LOOKUP("gpio-pxa", GPIO75_HX4700_EARPHONE_nDET, > + "earphone-det", GPIO_ACTIVE_LOW), > + GPIO_LOOKUP("gpio-pxa", GPIO107_HX4700_SPK_nSD, > + "spk-sd", GPIO_ACTIVE_LOW), So those two have switched polarity. > @@ -81,14 +79,14 @@ static const struct snd_soc_ops hx4700_ops = { > static int hx4700_spk_power(struct snd_soc_dapm_widget *w, > struct snd_kcontrol *k, int event) > { > - gpio_set_value(GPIO107_HX4700_SPK_nSD, !!SND_SOC_DAPM_EVENT_ON(event)); > + gpiod_set_value(gpiod_spk_sd, !!SND_SOC_DAPM_EVENT_ON(event)); Thus drop one ! in front of the expression, just !SND_SOC_DAPM_EVENT_ON(event) > - gpio_set_value(GPIO92_HX4700_HP_DRIVER, !!SND_SOC_DAPM_EVENT_ON(event)); > + gpiod_set_value(gpiod_hp_driver, !!SND_SOC_DAPM_EVENT_ON(event)); But not this. > + gpiod_spk_sd = devm_gpiod_get(&pdev->dev, "spk-sd", GPIOD_OUT_LOW); These initial values don't seem to be set in the old code you could just use GPIOD_ASIS as flag to make sure the new code behaves the same. Yours, Linus Walleij From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A2518C433EF for ; Wed, 4 May 2022 22:00:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:Subject:Message-ID:Date:From: In-Reply-To:References:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=r9D/uj2F3EltF0hK2PTjvkG56VOLlMLTnOCamQiZlN4=; b=CtRqgbFFVp14DF x35CPCodeLnWfzrTarHbGXFvVcR82TcqDeEuYW4NtwPaw8gT/TgmZrEQ6WlK+tmuks4m3K3orBU4X YDdacjibyNfOUFwRzumbAB9OKqf5FE1Ud05X4s3h2z4c66x/ZFH04ZhuyM/uyc0OjMSTltZ8djUDu r08geKemLIWBxjw4LqLqE/7sAYrpAaS2m6LCi7IrzFJVRAX5jpfErVBzPk0Br9zBMu18mEGcmarXA 6czRqi3kEUvvSMjBzg5EWzqMMdb8uadmkt8+WZVXd3eVjAkziO/6NmXwghnH5Qg+lwxISQTanchEX Hx8prY6VLWeSwtyIt7kg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nmN2N-00D1CA-AM; Wed, 04 May 2022 21:59:59 +0000 Received: from mail-yb1-xb2b.google.com ([2607:f8b0:4864:20::b2b]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nmN2A-00D17G-N8 for linux-mtd@lists.infradead.org; Wed, 04 May 2022 21:59:48 +0000 Received: by mail-yb1-xb2b.google.com with SMTP id v59so4676976ybi.12 for ; Wed, 04 May 2022 14:59:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=rmJxiEP7m5MkHAr9riUqfx3uT8FiWx1lLvenswbOwJo=; b=QoiC7QZe2hJyujp1ZRg0nlXjXopykN2j/DeYH65TBWATXUktJf0x/kyffuuacsI/Xo 3U/WGyV+fixlajIQ09GKt1DZZYpxMas0dWaDYCL8jonCJtMRr4CSZtyBZVh8caz3Zhfm KLVYZqsNmH6MjXnLA95998XCfsQEg4LoRnNmHuqp/sQ2AApgVFWMqqZBdroSiC1gbSmN F4COMU/J9YGu52LHRSSP9wDA3f+g3bnizNxpCHxuTE9h/gJ7KhKhsdH72IujMMikVg4I fP3vyeXEvVrVnkAX/oRVPo4TmV6M5W4ptTtqSYXWLDxsKe5hoIl7+BOBmDpgqE7s/ubD 8xlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=rmJxiEP7m5MkHAr9riUqfx3uT8FiWx1lLvenswbOwJo=; b=5ZX/uJATIGoNJEW1InZgSHIdsr3ansTuu/YzwlWtUCOp2SlOB/JDnR4lTIwlY4elBl OSoayNgvX1MRG8XVtBZLDS5/kD2w2vInHJVF79kjLJjcYKCFFeA4+jNA8P+Zv0pfAsWP 3NIkG8p4zGMOj1hZhjqr0LMuoW+jtv7JZciDSg+pSoUrbEZatM+NAR3hQe/Huiog0Fwn BSrLEtCUICBvg91jnlrCAaBMWHFh0rQpPIFjifnNOgv2F7Z7rCddMWCipbnT40W8JRZu V9dwTBA+iSKze16XyiVJkKEzlJXf2pXd7WsowubK4ITvNWzOa6w0QOk7Vk96T5/tDncr zQeQ== X-Gm-Message-State: AOAM533CmZvKkoXGTIWyd9QJzTDP3Hr2PIlRW2f+S6I2/opXGfv9L1WC oKHhVKtgyu7M/DNj5ybmi5b4f1QhNyUiCREkvKvB4Q== X-Google-Smtp-Source: ABdhPJws0kFu4uk8m+EBRW3/56Ag/4uZ6hdskWay/lA/R4RBYkLUb5oUPb5cyXOdcEWwAD5EvFRWUXI3Mh6lxHFGeY0= X-Received: by 2002:a25:bcc7:0:b0:648:d728:d39 with SMTP id l7-20020a25bcc7000000b00648d7280d39mr19634791ybm.514.1651701582183; Wed, 04 May 2022 14:59:42 -0700 (PDT) MIME-Version: 1.0 References: <20220419163810.2118169-1-arnd@kernel.org> <20220419163810.2118169-19-arnd@kernel.org> In-Reply-To: From: Linus Walleij Date: Wed, 4 May 2022 23:59:30 +0200 Message-ID: Subject: Re: [PATCH 18/48] ARM: pxa: hx4700: use gpio descriptors for audio To: Arnd Bergmann Cc: Robert Jarzmik , Linux ARM , Arnd Bergmann , Daniel Mack , Haojian Zhuang , Marek Vasut , Philipp Zabel , Lubomir Rintel , Paul Parsons , Tomas Cech , Sergey Lapin , Thomas Bogendoerfer , Michael Turquette , Stephen Boyd , "Rafael J. Wysocki" , Viresh Kumar , Dmitry Torokhov , Ulf Hansson , Dominik Brodowski , Helge Deller , Mark Brown , Linux Kernel Mailing List , "open list:BROADCOM NVRAM DRIVER" , IDE-ML , linux-clk , Linux PM list , "open list:HID CORE LAYER" , patches@opensource.cirrus.com, linux-leds@vger.kernel.org, linux-mmc , linux-mtd , linux-rtc@vger.kernel.org, USB list , Linux Fbdev development list , dri-devel , ALSA Development Mailing List X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220504_145946_799317_774441E9 X-CRM114-Status: GOOD ( 27.56 ) X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-mtd" Errors-To: linux-mtd-bounces+linux-mtd=archiver.kernel.org@lists.infradead.org On Mon, May 2, 2022 at 9:08 AM Arnd Bergmann wrote: > On Sun, May 1, 2022 at 11:41 PM Linus Walleij wrote: > > > > (...) > > > +static struct gpiod_lookup_table hx4700_audio_gpio_table = { > > > + .dev_id = "hx4700-audio", > > > + .table = { > > > + GPIO_LOOKUP("gpio-pxa", GPIO75_HX4700_EARPHONE_nDET, > > > + "earphone-ndet", GPIO_ACTIVE_HIGH), > > > > This looks wrong. The n in nDET in the end of the name of the GPIO line > > means active low does it not? > > > > What I usually do when I see this is to properly set it to > > GPIO_ACTIVE_LOW in the descriptor table, then invert the logic > > where it's getting used. > > > > Also rename to earphone-det instead of -ndet > > Thanks for taking a look! I changed it now, but I don't know if > I got the correct number of inversions in the end. How does this look? Looks wrong, you can just invert the argument to any statement of set_value() after tagging respective line as active low. Then gpilob will do a second inversion. > + GPIO_LOOKUP("gpio-pxa", GPIO75_HX4700_EARPHONE_nDET, > + "earphone-det", GPIO_ACTIVE_LOW), > + GPIO_LOOKUP("gpio-pxa", GPIO107_HX4700_SPK_nSD, > + "spk-sd", GPIO_ACTIVE_LOW), So those two have switched polarity. > @@ -81,14 +79,14 @@ static const struct snd_soc_ops hx4700_ops = { > static int hx4700_spk_power(struct snd_soc_dapm_widget *w, > struct snd_kcontrol *k, int event) > { > - gpio_set_value(GPIO107_HX4700_SPK_nSD, !!SND_SOC_DAPM_EVENT_ON(event)); > + gpiod_set_value(gpiod_spk_sd, !!SND_SOC_DAPM_EVENT_ON(event)); Thus drop one ! in front of the expression, just !SND_SOC_DAPM_EVENT_ON(event) > - gpio_set_value(GPIO92_HX4700_HP_DRIVER, !!SND_SOC_DAPM_EVENT_ON(event)); > + gpiod_set_value(gpiod_hp_driver, !!SND_SOC_DAPM_EVENT_ON(event)); But not this. > + gpiod_spk_sd = devm_gpiod_get(&pdev->dev, "spk-sd", GPIOD_OUT_LOW); These initial values don't seem to be set in the old code you could just use GPIOD_ASIS as flag to make sure the new code behaves the same. Yours, Linus Walleij ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/ From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2673CC433EF for ; Wed, 4 May 2022 22:01:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:Subject:Message-ID:Date:From: In-Reply-To:References:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=+avXB+PMCJscdO+1NYdvAQkcO9aBYTTPtdPaKHhpanw=; b=NnfYocc9mfXD+h XYvnLkxk3iCdR/3GuBsCl2fJWBNUboBscL/UKimQdqda0i1VMburNIniLKF8fvjNj5f4nyMfv7OYX M51NP0mTuvWsLBIFO9yfnjckoeIC+TpU7lPQeHTRw3Iv8sr0aISeyx+/pUuPAAv5I7UXA9UKir1pE D5otiJu5m6KpJRe0+a/GdjOvSGyEln3ekYbPcC+4eu/jgwI0uOBZ8iBE1veXAklCS428i9neruTG4 WpZRR12fysBMoLlPmAdJ3ypDViVR+11lCwqaVEBvsoScjOIGN4G58TU4AUdM/RLDKda/sMlCHGNL/ 8+FbW+OEjJI81W5wIWaQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nmN2E-00D19t-PY; Wed, 04 May 2022 21:59:50 +0000 Received: from mail-yb1-xb32.google.com ([2607:f8b0:4864:20::b32]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nmN2A-00D17F-NJ for linux-arm-kernel@lists.infradead.org; Wed, 04 May 2022 21:59:48 +0000 Received: by mail-yb1-xb32.google.com with SMTP id y76so4732983ybe.1 for ; Wed, 04 May 2022 14:59:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=rmJxiEP7m5MkHAr9riUqfx3uT8FiWx1lLvenswbOwJo=; b=QoiC7QZe2hJyujp1ZRg0nlXjXopykN2j/DeYH65TBWATXUktJf0x/kyffuuacsI/Xo 3U/WGyV+fixlajIQ09GKt1DZZYpxMas0dWaDYCL8jonCJtMRr4CSZtyBZVh8caz3Zhfm KLVYZqsNmH6MjXnLA95998XCfsQEg4LoRnNmHuqp/sQ2AApgVFWMqqZBdroSiC1gbSmN F4COMU/J9YGu52LHRSSP9wDA3f+g3bnizNxpCHxuTE9h/gJ7KhKhsdH72IujMMikVg4I fP3vyeXEvVrVnkAX/oRVPo4TmV6M5W4ptTtqSYXWLDxsKe5hoIl7+BOBmDpgqE7s/ubD 8xlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=rmJxiEP7m5MkHAr9riUqfx3uT8FiWx1lLvenswbOwJo=; b=yhFFy/GLFyWjtwpxR6v2oC+h8pBWY0r/N37Xab4hcVQAPlhM7IX/II5TzJwUf9FE1y v9H5NnAcyBmoeAr1W0PC0J02i2FYHJyprVXhzpZnz+dreLlwV1iHbbjLvfAai+szSrWd wVoFuVYUKXiDxO9I6RB6tY5ketbAJ19vdnf7LX8VcaeqThSk//LNhIYEsyk6p7nfIapx BhazjPWgH/bWzcUp2gUW1Xn4ct2R2wmeaKHYTOICB6VL91a8+ft0vjT/oXhxDnDcok9u fAFSKeT/KJ3H0YEwFvJJHDdrRa0EQpV0xha2fsk71x+FSQF6LG5/q8/QgVjp/JMIlf35 qU+Q== X-Gm-Message-State: AOAM532rgFPqwj54wbFqHHiUXAsGRdx5AKXUakStf/f672nGvw+qDHtL sei8ksCG1Ighb5ld6AQntgbCAMWHt8JTm5kb7JtzYA== X-Google-Smtp-Source: ABdhPJws0kFu4uk8m+EBRW3/56Ag/4uZ6hdskWay/lA/R4RBYkLUb5oUPb5cyXOdcEWwAD5EvFRWUXI3Mh6lxHFGeY0= X-Received: by 2002:a25:bcc7:0:b0:648:d728:d39 with SMTP id l7-20020a25bcc7000000b00648d7280d39mr19634791ybm.514.1651701582183; Wed, 04 May 2022 14:59:42 -0700 (PDT) MIME-Version: 1.0 References: <20220419163810.2118169-1-arnd@kernel.org> <20220419163810.2118169-19-arnd@kernel.org> In-Reply-To: From: Linus Walleij Date: Wed, 4 May 2022 23:59:30 +0200 Message-ID: Subject: Re: [PATCH 18/48] ARM: pxa: hx4700: use gpio descriptors for audio To: Arnd Bergmann Cc: Robert Jarzmik , Linux ARM , Arnd Bergmann , Daniel Mack , Haojian Zhuang , Marek Vasut , Philipp Zabel , Lubomir Rintel , Paul Parsons , Tomas Cech , Sergey Lapin , Thomas Bogendoerfer , Michael Turquette , Stephen Boyd , "Rafael J. Wysocki" , Viresh Kumar , Dmitry Torokhov , Ulf Hansson , Dominik Brodowski , Helge Deller , Mark Brown , Linux Kernel Mailing List , "open list:BROADCOM NVRAM DRIVER" , IDE-ML , linux-clk , Linux PM list , "open list:HID CORE LAYER" , patches@opensource.cirrus.com, linux-leds@vger.kernel.org, linux-mmc , linux-mtd , linux-rtc@vger.kernel.org, USB list , Linux Fbdev development list , dri-devel , ALSA Development Mailing List X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220504_145946_821001_9E494600 X-CRM114-Status: GOOD ( 28.33 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, May 2, 2022 at 9:08 AM Arnd Bergmann wrote: > On Sun, May 1, 2022 at 11:41 PM Linus Walleij wrote: > > > > (...) > > > +static struct gpiod_lookup_table hx4700_audio_gpio_table = { > > > + .dev_id = "hx4700-audio", > > > + .table = { > > > + GPIO_LOOKUP("gpio-pxa", GPIO75_HX4700_EARPHONE_nDET, > > > + "earphone-ndet", GPIO_ACTIVE_HIGH), > > > > This looks wrong. The n in nDET in the end of the name of the GPIO line > > means active low does it not? > > > > What I usually do when I see this is to properly set it to > > GPIO_ACTIVE_LOW in the descriptor table, then invert the logic > > where it's getting used. > > > > Also rename to earphone-det instead of -ndet > > Thanks for taking a look! I changed it now, but I don't know if > I got the correct number of inversions in the end. How does this look? Looks wrong, you can just invert the argument to any statement of set_value() after tagging respective line as active low. Then gpilob will do a second inversion. > + GPIO_LOOKUP("gpio-pxa", GPIO75_HX4700_EARPHONE_nDET, > + "earphone-det", GPIO_ACTIVE_LOW), > + GPIO_LOOKUP("gpio-pxa", GPIO107_HX4700_SPK_nSD, > + "spk-sd", GPIO_ACTIVE_LOW), So those two have switched polarity. > @@ -81,14 +79,14 @@ static const struct snd_soc_ops hx4700_ops = { > static int hx4700_spk_power(struct snd_soc_dapm_widget *w, > struct snd_kcontrol *k, int event) > { > - gpio_set_value(GPIO107_HX4700_SPK_nSD, !!SND_SOC_DAPM_EVENT_ON(event)); > + gpiod_set_value(gpiod_spk_sd, !!SND_SOC_DAPM_EVENT_ON(event)); Thus drop one ! in front of the expression, just !SND_SOC_DAPM_EVENT_ON(event) > - gpio_set_value(GPIO92_HX4700_HP_DRIVER, !!SND_SOC_DAPM_EVENT_ON(event)); > + gpiod_set_value(gpiod_hp_driver, !!SND_SOC_DAPM_EVENT_ON(event)); But not this. > + gpiod_spk_sd = devm_gpiod_get(&pdev->dev, "spk-sd", GPIOD_OUT_LOW); These initial values don't seem to be set in the old code you could just use GPIOD_ASIS as flag to make sure the new code behaves the same. Yours, Linus Walleij _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel