Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp3462880rdb; Wed, 13 Sep 2023 12:48:31 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFRavH6TkEvYGXiIQJEUdPkOqVqqaT1b/G8m6InJBHixeK5cA61DKoHC9lDfBgtiFYjBBSB X-Received: by 2002:a05:6a00:15d0:b0:68b:ff3b:e14a with SMTP id o16-20020a056a0015d000b0068bff3be14amr4045417pfu.18.1694634511349; Wed, 13 Sep 2023 12:48:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694634511; cv=none; d=google.com; s=arc-20160816; b=lLk4JytHTeKS0lyXnCD62Zop/EELLIvxsZz2kYZ9V9qJOEYhQQztx4xtLwlJp4GyVa nPrQmUaPNPvR8pqtCdPsxrV49fPLXq4Kpfj82OxRuOjZp7HHvCKDVKki3vYmu9GOMpks TlDVCVA+RhfzLaOkJrmB3benCSMQW2vx+8A51FOrwqGezfUrVYpUdYd0I8nYPQwvTCfY yoA8wpm6ImUejCIaup4qsPH8KLwLstoyLKy7qSMhv2pqzdMRBw7X2qvsUVt/vqbgiNFz 378jfPu7Vw5dbGhulp0FCs8dInsIm+ZahnT5Qlv7QiRZEj+mz9R5vbpfUe6Gm1rcjSx3 fN+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=ofo7sSePT/jaZ7VhEZ8Xa5CLpX5xgx/ZwhBkOWdddew=; fh=oYDs3amvvgldlbDiKBXfwkEbBmm4kPwpMyECeXkyol8=; b=yZaXMIJ/OisiU595gEaPLf7FkjvxmeskfnVyvK2wtGz34y0A7uqjW3lC1cuj/NF2nP qZYvhhZkSmvuqq/yYufGzuBUenyZpS/wVJRMokPQZ8BU3fYbbC4KDQGf+5ECeKQcltl/ ItA5EopQYgOJvBONXeup6y2p08pG2KK40G3Mt3FLp0W7J9FKlWKoNBNwUtkugagYmf9g 3V/NucXIkk1BP2ejkBVlRYimxjzRPH1//Vm9+UZjE5lqKpGwpT/nnA534kzHXX6fD74a rmvuXhGpv5Jly7cdnHXFx9Vgjk0w89ZIGCRKhrT/8c7BKwaDmDihfGR89FLirsZ0cHxW DSXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20230601.gappssmtp.com header.s=20230601 header.b=FS6PKu7c; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id ck12-20020a056a00328c00b0068e4661404asi10572708pfb.392.2023.09.13.12.48.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Sep 2023 12:48:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@bgdev-pl.20230601.gappssmtp.com header.s=20230601 header.b=FS6PKu7c; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 26DEF8303A1F; Wed, 13 Sep 2023 05:39:39 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231339AbjIMMji (ORCPT + 99 others); Wed, 13 Sep 2023 08:39:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40904 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233560AbjIMMjh (ORCPT ); Wed, 13 Sep 2023 08:39:37 -0400 Received: from mail-vs1-xe34.google.com (mail-vs1-xe34.google.com [IPv6:2607:f8b0:4864:20::e34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2A53B19B6 for ; Wed, 13 Sep 2023 05:39:33 -0700 (PDT) Received: by mail-vs1-xe34.google.com with SMTP id ada2fe7eead31-44ee7688829so2237775137.2 for ; Wed, 13 Sep 2023 05:39:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1694608772; x=1695213572; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=ofo7sSePT/jaZ7VhEZ8Xa5CLpX5xgx/ZwhBkOWdddew=; b=FS6PKu7cFaiKkXGoREvmNvcSSWrkorNOoAb4llWAGsgpSLVeeW4D/Gm++e0sgDRfyS GBc0IFv3IqiDlzD7V1Pr6EYiCvtQas/PWj+QkoM5mKd1yYELakqwYdUWl2xAq8uhArXh h7GL6P+ZtWmXtporIoYgenT5SSaWXfwd09MSxxBHsnfZseW4XfKU5T+r57b+XRh35x/I DQkaWSQute483X7x8XwVGIlMJIZ6EhaWmd06OxHDG23iKaqye40V5kprbMb6FMVVdObJ n11R2oTaGCL5dijA3BNyqZwY0FO6AE0vJwhnXistP4pdxMgmIFGUFPnbjNndB88k9Lew zcPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694608772; x=1695213572; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ofo7sSePT/jaZ7VhEZ8Xa5CLpX5xgx/ZwhBkOWdddew=; b=aU+POEEaNoQtO+qHTvDmzYbVKWFImRGA3+buy9Xb3q4fqPdTJIAVJXETWOMy87iEUF bzx/+oReKUmIuh4wkg7kdPU9FMDp9QI24XWLjW4nxrEzRdreE2GdzvefE1lkeQTX94vQ IbjiQsaH1viTMXSetqUmP0nCS2lCY97BzQAcp1jp5xMyohpu7rfPthgJH+3NxMFXloUT rUJktDZLwjEiNP9CUbteCZaPFpZ2RTHssi+1Bj4xq+dcjwYBfapWuWzUDmz1NwXfmIvZ k51Cey2ej9ZwI9zbgAeeCC1vyZJRltM9wxuwpXaxdN0ujcqk8J7XDFqQDTbu42EWLrk7 GVvw== X-Gm-Message-State: AOJu0Yx5EmJBX8BFL4jWVPF5waknlHXsBrBXR1AGQWmKd/2SNuxdfN0Q +fsQdkFRiOdheCqSqn7inwxeJrnaJo7KatYhm9tEEg== X-Received: by 2002:a67:fa03:0:b0:447:779b:a357 with SMTP id i3-20020a67fa03000000b00447779ba357mr1865242vsq.32.1694608772217; Wed, 13 Sep 2023 05:39:32 -0700 (PDT) MIME-Version: 1.0 References: <20230913115001.23183-1-brgl@bgdev.pl> <20230913115001.23183-4-brgl@bgdev.pl> In-Reply-To: From: Bartosz Golaszewski Date: Wed, 13 Sep 2023 14:39:21 +0200 Message-ID: Subject: Re: [PATCH 3/5] mmc: slot-gpio: use gpiod_set_active_[low|high]() To: Linus Walleij Cc: Andy Shevchenko , Ulf Hansson , Paul Cercueil , Harvey Hunt , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Daniel Scally , Hans de Goede , Mark Gross , Heiner Kallweit , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mmc@vger.kernel.org, linux-mips@vger.kernel.org, linux-mtd@lists.infradead.org, platform-driver-x86@vger.kernel.org, Bartosz Golaszewski Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Wed, 13 Sep 2023 05:39:39 -0700 (PDT) X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email On Wed, Sep 13, 2023 at 2:24=E2=80=AFPM Linus Walleij wrote: > > On Wed, Sep 13, 2023 at 1:50=E2=80=AFPM Bartosz Golaszewski wrote: > > > From: Bartosz Golaszewski > > > > We have new, less cumbersome and clearer interfaces for controlling GPI= O > > polarity. Use them in the MMC code. > > > > Signed-off-by: Bartosz Golaszewski > > I like the looks of the code better, obviously but this looks like this f= or > a reason unfortunately. > > See the following from > Documentation/devicetree/bindings/mmc/mmc-controller.yaml: > > # CD and WP lines can be implemented on the hardware in one of two > # ways: as GPIOs, specified in cd-gpios and wp-gpios properties, or > # as dedicated pins. Polarity of dedicated pins can be specified, > # using *-inverted properties. GPIO polarity can also be specified > # using the GPIO_ACTIVE_LOW flag. This creates an ambiguity in the > # latter case. We choose to use the XOR logic for GPIO CD and WP > # lines. This means, the two properties are "superimposed," for > # example leaving the GPIO_ACTIVE_LOW flag clear and specifying the > # respective *-inverted property property results in a > # double-inversion and actually means the "normal" line polarity is > # in effect. > I hate it, thanks. :) > Will you still provide the desired "double inversion" after this patch? > Not in the current form. Would it work to go: if (override_active_level) { if (!(host->caps2 & MMC_CAP2_CD_ACTIVE_HIGH)) gpiod_set_active_high(desc); else gpiod_set_active_low(desc); } else { if (host->caps2 & MMC_CAP2_CD_ACTIVE_HIGH) gpiod_set_active_high(desc); else gpiod_set_active_low(desc); } ? Alternatively we could reimplement the toggle semantics locally in a helper function in order to get rid of it from GPIOLIB. Bart