Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp4097323rdb; Thu, 14 Sep 2023 11:36:41 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEXcyhGzeYwRKHURnv08mkCuv5d1fp0grSGRbiMUsYbx8l4iTjSPSU3pm0+Vupy0r4Jl6x7 X-Received: by 2002:a17:90b:4b4e:b0:26b:49de:13bd with SMTP id mi14-20020a17090b4b4e00b0026b49de13bdmr6201754pjb.36.1694716601295; Thu, 14 Sep 2023 11:36:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694716601; cv=none; d=google.com; s=arc-20160816; b=wEBnUrmJxCbRQ9Ei4du7CQ6SNY9WQCFYpXSVidqQTiJn9tY7+kAYdXTpmdAS5W/xG6 r7tDoNWNx31RuoHpbDy90vG1Epecs03Jld/24fci1rfcJh/OXzRzQHGlmnjKPWAYHUey 3qNzSjOKRc1eLfge5lTHcQwsVtP2k6pYsI5p935H1unsiDnUcN/xOwhDB/hTHBCDsWV9 qDZJGwnkTk2zBx13qtlZoNI7C0w/d3S3LYHoZnTrrr4g0nLcjlgdFyXhEwnvKhx9elXm 8dpuBZZULfBDbWAh4zeq59J17otED0qFA2v/g0SNTHE1e8Io/RPzQIdy3DlLheF6bXN2 3Mzg== 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=/f7PUGJTcZo4gRvXha7omFj7WFQCwx9ue2jacqTY10Y=; fh=VrCUDjEcZ8Ampwp0xEDw2W55zIH1no7/VhHEY2CfYKc=; b=XrkmI+17GioIEmHosW0G/dmoCXkKu9EvV0PO/5nTtaJFKk7vt56p3Er9Q0Wo0PRvso hb2etB3LWN5ND0rx30wKxfrgvLm5iZzWUKPpCxGxp8fzGNV+tJFqw2Yo7amAjEuqE+2L vqpSlq5lkm0hUvrh/TVggAKRjSgXmvMRyxIOI2itLedLlV9WrlsJlkETNzoPxRHaWBGo dELA++eWAzGH/UNwe5sqWHMp+xJRgQnZcsKIhsMM31lJywtaDAXDIEAVwd++CiY2ziMu vGqGSHB86qMNuu3ZB/XcwhU4NRg/BrJvqCWL+GXE44MdNaFx036Y9JX8m2Z2f5VhMGgi KBMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=tGmlho28; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id l10-20020a17090aec0a00b00267ba1c43adsi2023101pjy.101.2023.09.14.11.36.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Sep 2023 11:36:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=tGmlho28; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id C12C6827C188; Thu, 14 Sep 2023 01:32:11 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234271AbjINIcH (ORCPT + 99 others); Thu, 14 Sep 2023 04:32:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50382 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236180AbjINIcG (ORCPT ); Thu, 14 Sep 2023 04:32:06 -0400 Received: from mail-yw1-x1129.google.com (mail-yw1-x1129.google.com [IPv6:2607:f8b0:4864:20::1129]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 58F6F1BFC for ; Thu, 14 Sep 2023 01:32:02 -0700 (PDT) Received: by mail-yw1-x1129.google.com with SMTP id 00721157ae682-59bcd927b45so8099137b3.1 for ; Thu, 14 Sep 2023 01:32:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1694680321; x=1695285121; 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=/f7PUGJTcZo4gRvXha7omFj7WFQCwx9ue2jacqTY10Y=; b=tGmlho28soxbfJejqxqHWL8tl9D55vh2yT+NvtLZO+uPqG51xoJLZWfmLoUgRKGqdL VPJYUXp3n1eL0oZqhmz2hCa8vayoFWAF9LMbhIzArWyYbjdJOvq4WOn/7Y6R0yy5v9Hf LU6nPfs4YVw/9T1vQtYaDdfgUXp5O20+OVowgvpc8XQcedXLBlOy3fPrqKa5I4dEBKXk sNWbhnXvAV9PCDrnW2PzBdh2AfNtgTcD80vgUDA8j/bh4c1EhXY8mGIO5YKbmYISYKof AS4/RDdN1mfh+10frp+nvY5qKLCezpAviWs1MPUFgF2P4+4+NYhYllwem9kQw0RZ/fYT EKtA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694680321; x=1695285121; 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=/f7PUGJTcZo4gRvXha7omFj7WFQCwx9ue2jacqTY10Y=; b=hvp2trVt4Xb8TakVHewIM+HHnRCy/ADS4Iv91lLV5NkOviWpJ5MGBj32rwOolJ18Ny SeqBEqZ0LBYwINFIgpAj+hwmkP11GcrLYQe8YfQjrmK1sEB0xr7uXBAgwgBppJ2WKHr0 s4bJ+E9XRtwciesXiZ/NuY/NpXPMsuTfXxmO+s7400vkyCrGS/avuQDQkF5aQrLeXQNg s6oUEl9i+9nWt3WME2dOKl/wJvWcaDDGULRWXpw9E4Yzu0HcKBjKQidLIPPV6hqoEL1P iVbWMeBLKjvHTvpnlylqdGGnExuUGTAABkJClyVJlvYkrsgbRSkvJanI7SQtUJp+G4sf zFwg== X-Gm-Message-State: AOJu0YycCqgaBNmpzs7N9C7VlX3XSbarMDqqJz8G2be47Kwg1GbVyOH7 kSUGzZgIi7yiIhMXR/nVHvjzwd3uzSHUSAh3XXkDeQ== X-Received: by 2002:a25:b45:0:b0:d63:44e:cbcc with SMTP id 66-20020a250b45000000b00d63044ecbccmr4689080ybl.22.1694680321572; Thu, 14 Sep 2023 01:32:01 -0700 (PDT) MIME-Version: 1.0 References: <20230913115001.23183-1-brgl@bgdev.pl> <20230913115001.23183-4-brgl@bgdev.pl> In-Reply-To: From: Linus Walleij Date: Thu, 14 Sep 2023 10:31:48 +0200 Message-ID: Subject: Re: [PATCH 3/5] mmc: slot-gpio: use gpiod_set_active_[low|high]() To: Bartosz Golaszewski 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 (snail.vger.email [0.0.0.0]); Thu, 14 Sep 2023 01:32:11 -0700 (PDT) On Wed, Sep 13, 2023 at 2:39=E2=80=AFPM Bartosz Golaszewski = wrote: > 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 G= PIO > > > 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= for > > 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); > } > > ? I *think* so but my boolean parser i known to be flawed since I have screwed up double inversions repeatedly over the years, so it should not be trusted at all. > Alternatively we could reimplement the toggle semantics locally in a > helper function in order to get rid of it from GPIOLIB. I don't know about that, the flag is inside gpio_desc so we cannot access it (struct is private to gpiolib...) Yours, Linus Walleij