Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp2196368iob; Thu, 5 May 2022 18:41:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzpOCabzqLZT2KEmEWJ10DL6XI2phWmOvXn3fj5Wy9C6HTDTQyhsweOWbhL9gNnkWK60w8J X-Received: by 2002:a17:906:24cc:b0:6f3:bd82:b66b with SMTP id f12-20020a17090624cc00b006f3bd82b66bmr909624ejb.194.1651801308312; Thu, 05 May 2022 18:41:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651801308; cv=none; d=google.com; s=arc-20160816; b=SXNQ2O6d9Pe3S/hu7wEeaNhRztkmCrAijNW2oThA9hRyQH+hg0trpet+hhPwwEx39G groE1qwjxnmxWpxeeEkFlmARbE9VqIZU0vKQJRm/QFqX99ACGtoStRamwrptH2tHJS71 g4cNBqsx7f+I1c0ctqQWWfXC7/wRCfdNzkNDoxVOVXaCfpLsgEE8SbWuTME7wlOQ1j3w yn0bnsZ6zvoLuDyKOYlDTuD9I/d/jW+/ibrViIqI/glwUEaIK9JrJOetSEbMK70QUZ1i VD4+fokVRE+C5jcUxJ0VQAhlCiIl1i6JSByNE66PUqBnCf4iOWrvQSceoO2AE4XxgQep oqZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=rmJxiEP7m5MkHAr9riUqfx3uT8FiWx1lLvenswbOwJo=; b=onRJ6pPYVyxZ3hu6h6NWz6LJL2A0vhPJ1AlENVyJA6Khz6ixWkzBmaBrpAgYj3g4Di 5AQhND6zA4Dj7fy6Q9OR3gvWftPBUtmByI4Y/JoM+xeoCl7aCKzMixE5W3PnhzYY0taM vrpldbebud5nHY2cliQbAg1grj7tJv9HtBiHLSs5m9gJysuaRIe0zAqqCwdqTN7e4MEx SNpx26LFolfSs4rcL7e7uAE8RKN01GepGBrSQHhXtd8RNQpzfFZOASPWiqR+5vjkjL/l R3T13S9lZRXXSJ0+b2mlaSvd9uKQUCQ5UMN4lfUW1Dmh7uc1HMcURQlWMenVPY7bQGzr ww1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QoiC7QZe; 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=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id eb13-20020a0564020d0d00b0042839f5941dsi3474187edb.393.2022.05.05.18.41.25; Thu, 05 May 2022 18:41:48 -0700 (PDT) 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=@linaro.org header.s=google header.b=QoiC7QZe; 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=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378940AbiEDWDX (ORCPT + 99 others); Wed, 4 May 2022 18:03:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55704 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1357853AbiEDWDV (ORCPT ); Wed, 4 May 2022 18:03:21 -0400 Received: from mail-yb1-xb36.google.com (mail-yb1-xb36.google.com [IPv6:2607:f8b0:4864:20::b36]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3F77950B05 for ; Wed, 4 May 2022 14:59:43 -0700 (PDT) Received: by mail-yb1-xb36.google.com with SMTP id e12so4682638ybc.11 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=6aVJErBzrd0LFagv5QOiJO1EkaCZ+68mNkz/RNTw25HgYyfV8XvoMvT8ejIR3ZThHA KHAQdR/zvaThqmeKSzd3rXjS1oFVCk3QjowAltaZcf5KrNQVitYbstwTQCQSbf3FFq6+ wX1ELo3VzD0X0/paBuuRoJVtIgtrPRpBT5wRYEaJuRnf6TxYYyvFVY3Gv0J+9YXSqPw6 GWXIT2nlgzivbijFBKc33VU8/GgvJo7bbbW/6Cdjfpq3iuI8xpg+q4DM1Lw33BTWahqI v3FNHBc6iOg77T4HZrtUHIVs9UY9vWz7fkytZagrH0lk4XmMZRwNBl2cPK1quG8Fw48E bz3Q== X-Gm-Message-State: AOAM532joBarBgJ4Vnonu3bFhKDt8lpZ+DF37+5cV7ePdHdcsk8xpOyn coBBsNG7uujtZhfep4VZv/HxITVgkZExpzy7BNuXmQ== 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" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 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