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 84494C4321E for ; Thu, 5 May 2022 06:04:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244049AbiEEGIP (ORCPT ); Thu, 5 May 2022 02:08:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57590 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230306AbiEEGIN (ORCPT ); Thu, 5 May 2022 02:08:13 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E07F8366A5; Wed, 4 May 2022 23:04:34 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 766EA61C03; Thu, 5 May 2022 06:04:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CF6FEC385BC; Thu, 5 May 2022 06:04:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1651730673; bh=gGag8LcvVDzOYjY7vVQNICNRVUATqvouUQ3T9qB8Y4k=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=IzeX2fl3N2x2kryaheKunqUXxhYq2EKW3EevzAcRMispu7pOGu+LIVB4gtA4lt47H kuw8arO+PfbPq7WQnALg8Llzkb+hKwtvB/sYTsnK/90IacYZCB6DJZ5ZQJOsJ5C1F3 TeSHzM+uYa+G41zdiYBmFF25L9TEm88hz+cFkf+LED+1kXeRmilzEAvsC7hDnbfjGn 7+T7Dj+o9VKBm1U6ge16L5XMEd+1ntq34MUjLp9fn2cdJO958LQytdZ8prNLl0PmNR JJUBc01v6sbgWXUsh3IWA1bR3+vxPlhbpLgI0/bOseW+q4bkkad+M4ksyG11vuvJyh VmRMQT8XoxC+g== Received: by mail-wm1-f49.google.com with SMTP id q20so2010918wmq.1; Wed, 04 May 2022 23:04:33 -0700 (PDT) X-Gm-Message-State: AOAM532KYwJ4kV4x0ust3FQTY5P7lDLmdAqa0ZHF8tckDNZFQ3EHpIll agg4oXhlxqv95Hv8yxNuanYbXaFOameqvZcXfEI= X-Google-Smtp-Source: ABdhPJxJJBc6IXeb9FDBUjhMgPRC02W3Kaja9XP7Gl4879zHpOvDa2WCA8GypEt4poAHxn+t5qvz/Rnv+5FUxU+6qJI= X-Received: by 2002:a05:600c:4f0f:b0:394:54c1:f5b3 with SMTP id l15-20020a05600c4f0f00b0039454c1f5b3mr3065513wmq.33.1651730671693; Wed, 04 May 2022 23:04:31 -0700 (PDT) MIME-Version: 1.0 References: <20220419163810.2118169-1-arnd@kernel.org> <20220419163810.2118169-19-arnd@kernel.org> In-Reply-To: From: Arnd Bergmann Date: Thu, 5 May 2022 08:04:14 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 18/48] ARM: pxa: hx4700: use gpio descriptors for audio To: Linus Walleij 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 Wed, May 4, 2022 at 11:59 PM Linus Walleij wrote: > 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) Ok, done. But I still leave the extra 'invert=1' in hs_jack_pin[], right? /* Headphones jack detection DAPM pin */ static struct snd_soc_jack_pin hs_jack_pin[] = { { .pin = "Headphone Jack", .mask = SND_JACK_HEADPHONE, }, { .pin = "Speaker", /* disable speaker when hp jack is inserted */ .mask = SND_JACK_HEADPHONE, .invert = 1, }, }; > > + 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. Ok. Arnd 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 4994EC433F5 for ; Thu, 5 May 2022 06:04:37 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 33A7789179; Thu, 5 May 2022 06:04:36 +0000 (UTC) Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by gabe.freedesktop.org (Postfix) with ESMTPS id CD2F689179 for ; Thu, 5 May 2022 06:04:34 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 176E061ABC for ; Thu, 5 May 2022 06:04:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 70F7AC385AC for ; Thu, 5 May 2022 06:04:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1651730673; bh=gGag8LcvVDzOYjY7vVQNICNRVUATqvouUQ3T9qB8Y4k=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=IzeX2fl3N2x2kryaheKunqUXxhYq2EKW3EevzAcRMispu7pOGu+LIVB4gtA4lt47H kuw8arO+PfbPq7WQnALg8Llzkb+hKwtvB/sYTsnK/90IacYZCB6DJZ5ZQJOsJ5C1F3 TeSHzM+uYa+G41zdiYBmFF25L9TEm88hz+cFkf+LED+1kXeRmilzEAvsC7hDnbfjGn 7+T7Dj+o9VKBm1U6ge16L5XMEd+1ntq34MUjLp9fn2cdJO958LQytdZ8prNLl0PmNR JJUBc01v6sbgWXUsh3IWA1bR3+vxPlhbpLgI0/bOseW+q4bkkad+M4ksyG11vuvJyh VmRMQT8XoxC+g== Received: by mail-wm1-f51.google.com with SMTP id bg25so2004917wmb.4 for ; Wed, 04 May 2022 23:04:33 -0700 (PDT) X-Gm-Message-State: AOAM530gledvDeo9hCqV/OF0z3hIVHgkdzkaoMvwdSLgdJioAkDVFSJm Avf7DEcW6SR/HYidtAwDnRA1+vgg1TsndHJlIQs= X-Google-Smtp-Source: ABdhPJxJJBc6IXeb9FDBUjhMgPRC02W3Kaja9XP7Gl4879zHpOvDa2WCA8GypEt4poAHxn+t5qvz/Rnv+5FUxU+6qJI= X-Received: by 2002:a05:600c:4f0f:b0:394:54c1:f5b3 with SMTP id l15-20020a05600c4f0f00b0039454c1f5b3mr3065513wmq.33.1651730671693; Wed, 04 May 2022 23:04:31 -0700 (PDT) MIME-Version: 1.0 References: <20220419163810.2118169-1-arnd@kernel.org> <20220419163810.2118169-19-arnd@kernel.org> In-Reply-To: From: Arnd Bergmann Date: Thu, 5 May 2022 08:04:14 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 18/48] ARM: pxa: hx4700: use gpio descriptors for audio To: Linus Walleij 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 Wed, May 4, 2022 at 11:59 PM Linus Walleij wrote: > 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) Ok, done. But I still leave the extra 'invert=1' in hs_jack_pin[], right? /* Headphones jack detection DAPM pin */ static struct snd_soc_jack_pin hs_jack_pin[] = { { .pin = "Headphone Jack", .mask = SND_JACK_HEADPHONE, }, { .pin = "Speaker", /* disable speaker when hp jack is inserted */ .mask = SND_JACK_HEADPHONE, .invert = 1, }, }; > > + 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. Ok. Arnd 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 8A330C433EF for ; Thu, 5 May 2022 06:05:13 +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=EpmnQWTTt2ZDVqngO9SGebBOZnBlnDXhtSBoxxOIPnY=; b=Ykt7+zRlnxMa6g kcvsCPSHDhNE2jbQq250ybv90XZdEi0yCvVbsifk6BmPMQQ3rUDeWaH57eK5mT38uV9E7N2Iptul+ XfEUHDz5GU5cd8Qs5GFCdAcWaqMMky9pWCSwGQ7k4eXqoYG2j2zFPMDmd78SKrrJv6nFUrx1ayZm5 dUjWkl7DDktJBoC8k1Qy46fbpvx2Z1HMOfbNnej8O9RuK9fsJ+szBrjlgX/W3dwmPQx+jGsscq4nF JZaxmcZJToeZEhIUS/+FyNH/OS9oYC8XG71UmrYjjVFdm4PqEYZKqBNTclGz/YrwFx22Uz899aOgg WeOVcfkScjnTJVYpJseg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nmUbW-00E8Lh-Bu; Thu, 05 May 2022 06:04:46 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nmUbL-00E8IG-0k; Thu, 05 May 2022 06:04:36 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2A35261B0B; Thu, 5 May 2022 06:04:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7EF9EC385B0; Thu, 5 May 2022 06:04:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1651730673; bh=gGag8LcvVDzOYjY7vVQNICNRVUATqvouUQ3T9qB8Y4k=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=IzeX2fl3N2x2kryaheKunqUXxhYq2EKW3EevzAcRMispu7pOGu+LIVB4gtA4lt47H kuw8arO+PfbPq7WQnALg8Llzkb+hKwtvB/sYTsnK/90IacYZCB6DJZ5ZQJOsJ5C1F3 TeSHzM+uYa+G41zdiYBmFF25L9TEm88hz+cFkf+LED+1kXeRmilzEAvsC7hDnbfjGn 7+T7Dj+o9VKBm1U6ge16L5XMEd+1ntq34MUjLp9fn2cdJO958LQytdZ8prNLl0PmNR JJUBc01v6sbgWXUsh3IWA1bR3+vxPlhbpLgI0/bOseW+q4bkkad+M4ksyG11vuvJyh VmRMQT8XoxC+g== Received: by mail-wm1-f51.google.com with SMTP id m62so2004519wme.5; Wed, 04 May 2022 23:04:33 -0700 (PDT) X-Gm-Message-State: AOAM533FZuoU6QNBszT0udD3fZfvXmoii9AkxI5dFSbdLfGqZdijp+3M fQ/wE0B+3MBuArASiLwO2Z7zTtPrX3uEy+rJkzk= X-Google-Smtp-Source: ABdhPJxJJBc6IXeb9FDBUjhMgPRC02W3Kaja9XP7Gl4879zHpOvDa2WCA8GypEt4poAHxn+t5qvz/Rnv+5FUxU+6qJI= X-Received: by 2002:a05:600c:4f0f:b0:394:54c1:f5b3 with SMTP id l15-20020a05600c4f0f00b0039454c1f5b3mr3065513wmq.33.1651730671693; Wed, 04 May 2022 23:04:31 -0700 (PDT) MIME-Version: 1.0 References: <20220419163810.2118169-1-arnd@kernel.org> <20220419163810.2118169-19-arnd@kernel.org> In-Reply-To: From: Arnd Bergmann Date: Thu, 5 May 2022 08:04:14 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 18/48] ARM: pxa: hx4700: use gpio descriptors for audio To: Linus Walleij 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_230435_177259_AE3E4863 X-CRM114-Status: GOOD ( 33.18 ) 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 Wed, May 4, 2022 at 11:59 PM Linus Walleij wrote: > 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) Ok, done. But I still leave the extra 'invert=1' in hs_jack_pin[], right? /* Headphones jack detection DAPM pin */ static struct snd_soc_jack_pin hs_jack_pin[] = { { .pin = "Headphone Jack", .mask = SND_JACK_HEADPHONE, }, { .pin = "Speaker", /* disable speaker when hp jack is inserted */ .mask = SND_JACK_HEADPHONE, .invert = 1, }, }; > > + 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. Ok. Arnd ______________________________________________________ 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 3BC37C433F5 for ; Thu, 5 May 2022 06:05:52 +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=JCGDcVXQua6KeQEZKtUs5PoEGQxjyfETP1gLP3gMW/8=; b=gWA7ZJ432tBCKA A1IjFKx0TvvQA+5QsIbo6QX5umhsOkJEqJ1L8T2ao7B+NFC86NX9g1n9Sn5edOS0WqrDNwAm3vSt1 TBWBloOGktv0rv1bT8SaZ1Ey3f+UlMXfueiwaSBzjKJPdKdqvisZlFTAhHydDruOMIROp+HXhfOJW KDfNUUw2huKV7tyiAKb3bp194qFW563/A7D3ymO1Xsgmm6CZ/63JJkYSz7H3NLZEl3YS/kek5j7SQ yw00B/E4FcDXhH+KyEy6dtrFxbm3tPrsTYwttup66zh24ezFtDVaPHMrabt1p6g8yhS5PLbYdWh3D jaWvU/oLz9BqtXOdWm3g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nmUbN-00E8Im-Rq; Thu, 05 May 2022 06:04:37 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nmUbL-00E8IG-0k; Thu, 05 May 2022 06:04:36 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2A35261B0B; Thu, 5 May 2022 06:04:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7EF9EC385B0; Thu, 5 May 2022 06:04:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1651730673; bh=gGag8LcvVDzOYjY7vVQNICNRVUATqvouUQ3T9qB8Y4k=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=IzeX2fl3N2x2kryaheKunqUXxhYq2EKW3EevzAcRMispu7pOGu+LIVB4gtA4lt47H kuw8arO+PfbPq7WQnALg8Llzkb+hKwtvB/sYTsnK/90IacYZCB6DJZ5ZQJOsJ5C1F3 TeSHzM+uYa+G41zdiYBmFF25L9TEm88hz+cFkf+LED+1kXeRmilzEAvsC7hDnbfjGn 7+T7Dj+o9VKBm1U6ge16L5XMEd+1ntq34MUjLp9fn2cdJO958LQytdZ8prNLl0PmNR JJUBc01v6sbgWXUsh3IWA1bR3+vxPlhbpLgI0/bOseW+q4bkkad+M4ksyG11vuvJyh VmRMQT8XoxC+g== Received: by mail-wm1-f51.google.com with SMTP id m62so2004519wme.5; Wed, 04 May 2022 23:04:33 -0700 (PDT) X-Gm-Message-State: AOAM533FZuoU6QNBszT0udD3fZfvXmoii9AkxI5dFSbdLfGqZdijp+3M fQ/wE0B+3MBuArASiLwO2Z7zTtPrX3uEy+rJkzk= X-Google-Smtp-Source: ABdhPJxJJBc6IXeb9FDBUjhMgPRC02W3Kaja9XP7Gl4879zHpOvDa2WCA8GypEt4poAHxn+t5qvz/Rnv+5FUxU+6qJI= X-Received: by 2002:a05:600c:4f0f:b0:394:54c1:f5b3 with SMTP id l15-20020a05600c4f0f00b0039454c1f5b3mr3065513wmq.33.1651730671693; Wed, 04 May 2022 23:04:31 -0700 (PDT) MIME-Version: 1.0 References: <20220419163810.2118169-1-arnd@kernel.org> <20220419163810.2118169-19-arnd@kernel.org> In-Reply-To: From: Arnd Bergmann Date: Thu, 5 May 2022 08:04:14 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 18/48] ARM: pxa: hx4700: use gpio descriptors for audio To: Linus Walleij 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_230435_177259_AE3E4863 X-CRM114-Status: GOOD ( 33.18 ) 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 Wed, May 4, 2022 at 11:59 PM Linus Walleij wrote: > 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) Ok, done. But I still leave the extra 'invert=1' in hs_jack_pin[], right? /* Headphones jack detection DAPM pin */ static struct snd_soc_jack_pin hs_jack_pin[] = { { .pin = "Headphone Jack", .mask = SND_JACK_HEADPHONE, }, { .pin = "Speaker", /* disable speaker when hp jack is inserted */ .mask = SND_JACK_HEADPHONE, .invert = 1, }, }; > > + 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. Ok. Arnd _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel