From patchwork Wed Sep 13 11:49:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 722918 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 BCA41EDEC4A for ; Wed, 13 Sep 2023 11:50:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240538AbjIMLuZ (ORCPT ); Wed, 13 Sep 2023 07:50:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47094 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240510AbjIMLuY (ORCPT ); Wed, 13 Sep 2023 07:50:24 -0400 Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 781681996 for ; Wed, 13 Sep 2023 04:50:20 -0700 (PDT) Received: by mail-wr1-x42c.google.com with SMTP id ffacd0b85a97d-31fc91d5ca6so472950f8f.0 for ; Wed, 13 Sep 2023 04:50:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1694605819; x=1695210619; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=YzyriHXDyGfsqSRGhB6U9l6fcpz9mRdaLbPmEard1K0=; b=wlAimHdr0JCDmOb03eTk5kgHiJqcEUNDbeZJ17Ujyb8Bulg1333oDjT+W/JAqjYg5R nAT7fWijaClkmMZOXkVBGTtoluxqI6Z0z7OhNUjguWteV4O2JZCeVrhkz5YKjTyz7iZl d0tWbaipDjCQUMogpTM30YSWslaRmlF1S7Xlw7EzgcyXsmValJ9zR/vPu8lb4CAnddEh IFK5uFQXqT6ZlZ1wE8PeibMEnIb6wX2KFbNuVnMuEvTkV3454cGKU6kAoKfObFQzlqFx cONcCEmSZnvbMzK9tno4pPDzt/8IN91qnFHwixCtechAHiD8MGhlyS+jWXl8kzIv/y7Y A3uw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694605819; x=1695210619; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=YzyriHXDyGfsqSRGhB6U9l6fcpz9mRdaLbPmEard1K0=; b=cItdaPBZCVKOHScURfP47XRjYtF2LJcx5YvmD9KRbz6p9OM4sdRVbY5s9KupqroyCX QGfM+/MePdPSS4TePqzpdejZVOC3m/Lavm9upmpK+jS1uG/zYPnJWg7yCMFKSvpAmqXT TSub3DaSoKXPzlf5s5NgMLyrc8dhTp6osHB7bVr+x/eqwp7QPqc4QX6e1aB09YTWX02h t6xp/My6itJZH+1bECORsXeGyDaBZ5Ltmr7xVrggNKxPVhDKltBROv0Vp+mX/QJqbg+w K9vh6LcVNcghvwGEIw07M0/SRmfMLKW4CoMQ9HbCWT8oBxdxdsLK/1lYAcKULekZ2ZM8 IuSA== X-Gm-Message-State: AOJu0YxayAueRg0xWyQPAFH856XkORr4tOijKKapla63TumN1497E4EB d+z7DzTRLvUagRJZDmuCljJBoA== X-Google-Smtp-Source: AGHT+IHc3Nnqh7FxXn5j82zlMwGGyFk0UEacPknUOdO1EfjviMuMeXi35mpFtRpdkqCvV2719fQtUA== X-Received: by 2002:a5d:620a:0:b0:313:f61c:42ab with SMTP id y10-20020a5d620a000000b00313f61c42abmr1731997wru.56.1694605818963; Wed, 13 Sep 2023 04:50:18 -0700 (PDT) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:3b50:bca5:a754:7463]) by smtp.gmail.com with ESMTPSA id j14-20020adfd20e000000b0031fc4c31d77sm1932689wrh.88.2023.09.13.04.50.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Sep 2023 04:50:18 -0700 (PDT) From: Bartosz Golaszewski To: Linus Walleij , Andy Shevchenko , Ulf Hansson , Paul Cercueil , Harvey Hunt , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Daniel Scally , Hans de Goede , Mark Gross , Heiner Kallweit Cc: 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 Subject: [PATCH 1/5] gpiolib: provide gpiod_set_active_[low/high]() Date: Wed, 13 Sep 2023 13:49:57 +0200 Message-Id: <20230913115001.23183-2-brgl@bgdev.pl> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230913115001.23183-1-brgl@bgdev.pl> References: <20230913115001.23183-1-brgl@bgdev.pl> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org From: Bartosz Golaszewski Out current interface for changing line polarity is quite cumbersome to use as it only "toggles" the current state instead of deterministically setting it. Because of that all but one user in the kernel first need check the current state anyway. Let's provide two new functions that allow users to set this value explicitly with the aim of removing the existing function. Signed-off-by: Bartosz Golaszewski --- drivers/gpio/gpiolib.c | 22 ++++++++++++++++++++++ include/linux/gpio/consumer.h | 14 ++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index edffa0d2acaa..131965814a7c 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -2725,6 +2725,28 @@ void gpiod_toggle_active_low(struct gpio_desc *desc) } EXPORT_SYMBOL_GPL(gpiod_toggle_active_low); +/** + * gpiod_set_active_low() - set the GPIO as active-low + * @desc: the GPIO descriptor to set the active-low setting for + */ +void gpiod_set_active_low(struct gpio_desc *desc) +{ + VALIDATE_DESC_VOID(desc); + set_bit(FLAG_ACTIVE_LOW, &desc->flags); +} +EXPORT_SYMBOL_GPL(gpiod_set_active_low); + +/** + * gpiod_set_active_high() - set the GPIO as active-high + * @desc: the GPIO descriptor to set the active-low setting for + */ +void gpiod_set_active_high(struct gpio_desc *desc) +{ + VALIDATE_DESC_VOID(desc); + clear_bit(FLAG_ACTIVE_LOW, &desc->flags); +} +EXPORT_SYMBOL_GPL(gpiod_set_active_high); + static int gpio_chip_get_value(struct gpio_chip *gc, const struct gpio_desc *desc) { return gc->get ? gc->get(gc, gpio_chip_hwgpio(desc)) : -EIO; diff --git a/include/linux/gpio/consumer.h b/include/linux/gpio/consumer.h index 6cc345440a5b..ddbf0d8e4a75 100644 --- a/include/linux/gpio/consumer.h +++ b/include/linux/gpio/consumer.h @@ -160,6 +160,8 @@ int gpiod_set_raw_array_value_cansleep(unsigned int array_size, int gpiod_set_config(struct gpio_desc *desc, unsigned long config); int gpiod_set_debounce(struct gpio_desc *desc, unsigned int debounce); void gpiod_toggle_active_low(struct gpio_desc *desc); +void gpiod_set_active_low(struct gpio_desc *desc); +void gpiod_set_active_high(struct gpio_desc *desc); int gpiod_is_active_low(const struct gpio_desc *desc); int gpiod_cansleep(const struct gpio_desc *desc); @@ -499,6 +501,18 @@ static inline void gpiod_toggle_active_low(struct gpio_desc *desc) WARN_ON(desc); } +static inline void gpiod_set_active_low(struct gpio_desc *desc +{ + /* GPIO can never have been requested */ + WARN_ON(desc); +} + +static inline void gpiod_set_active_high(struct gpio_desc *desc) +{ + /* GPIO can never have been requested */ + WARN_ON(desc); +} + static inline int gpiod_is_active_low(const struct gpio_desc *desc) { /* GPIO can never have been requested */ From patchwork Wed Sep 13 11:49:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 722402 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 EF4C4EDEC50 for ; Wed, 13 Sep 2023 11:50:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240547AbjIMLu0 (ORCPT ); Wed, 13 Sep 2023 07:50:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47128 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240535AbjIMLuZ (ORCPT ); Wed, 13 Sep 2023 07:50:25 -0400 Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 815261999 for ; Wed, 13 Sep 2023 04:50:21 -0700 (PDT) Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-401d2e11dacso5430855e9.0 for ; Wed, 13 Sep 2023 04:50:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1694605820; x=1695210620; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ZfIOoxhDAqFwndjqT4NZlTiK/Oyr/4kFj6yAfQvO5X0=; b=Kt6Dg9PAdyJu64rbRPiB/YQgnFDw/OTAazlhmKFCcQR0Ugv08vQcaaQRM7oBHf1byY 47lb+nXanFWkiCncaBrTTF8VjZi41cJk1geT4sZvi0kq3u0PYDxTtTc+ciiSEDfnIx8h MNorN4K13cYToGQvg1ybvkl7Q2ATPTjM0D4VsuLG0fGGQfexm7kfL5yV4l/mbEPLDGAz 0pZwtXHiZ3QIl36ugfVsMeFPgFcuD85S8XMxDM/JJrWTBwNWIdnIcNGM9bua0y/ge7eu vVmV6fkE4S3cAoP66fpvhNrc2+Z6Y5hAGD8PIoUqu49BuEjjxpn3rzFQFzLsbVnGtnH3 qVvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694605820; x=1695210620; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ZfIOoxhDAqFwndjqT4NZlTiK/Oyr/4kFj6yAfQvO5X0=; b=kfA9bisp4uaFweIGJFOhy/dThA35HQXEmXI8C1YBcoLMXW1nG75zOeYivuLcbjYY8x +R3i4ayvElYiJNFASEW/dhU/lXTCrbf6oLtYjBeurTyHxToH27uWErBw2xNKRCezhSIa RbTn3yCSEekOuLmztxkChvFOdPnyBvJdOjqD5gR9EyyW3F0x7G10AlzUCuVmGtlIxjbf QhwhKD8Vm7J6BTNCcVBUxkXUraFpDSrHeBW6MnqYovsCsqegNZZbsY6DnYqlFJ1x3dWs TZB1BEkonI8r6PnPv3JZm0TuT+JvW0HW+rW9QlBEWMrfR4/f/0Ka0TaX36wrDzS4951G 5nhg== X-Gm-Message-State: AOJu0Yz09PE5uQgvkzQwsvD8O6K9jr/UOX2UXdB5TpoXX8+fxiJF4YJu 8HR0unxtov1YnfQ1Zy+Pe3VE3Q== X-Google-Smtp-Source: AGHT+IG+tXi5eOBKUfSbBaQCtatc0omt4sm58mllw94JLePpeq53xP2hYKGlGG+xCKfpc+HJfdMuUQ== X-Received: by 2002:a5d:5b18:0:b0:31f:cc46:3db9 with SMTP id bx24-20020a5d5b18000000b0031fcc463db9mr1114110wrb.26.1694605820092; Wed, 13 Sep 2023 04:50:20 -0700 (PDT) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:3b50:bca5:a754:7463]) by smtp.gmail.com with ESMTPSA id j14-20020adfd20e000000b0031fc4c31d77sm1932689wrh.88.2023.09.13.04.50.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Sep 2023 04:50:19 -0700 (PDT) From: Bartosz Golaszewski To: Linus Walleij , Andy Shevchenko , Ulf Hansson , Paul Cercueil , Harvey Hunt , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Daniel Scally , Hans de Goede , Mark Gross , Heiner Kallweit Cc: 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 Subject: [PATCH 2/5] mtd: rawnand: ingenic: use gpiod_set_active_high() Date: Wed, 13 Sep 2023 13:49:58 +0200 Message-Id: <20230913115001.23183-3-brgl@bgdev.pl> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230913115001.23183-1-brgl@bgdev.pl> References: <20230913115001.23183-1-brgl@bgdev.pl> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org From: Bartosz Golaszewski Use the new, less cumbersome interface for setting the GPIO as active-high that doesn't require first checking the current state. Signed-off-by: Bartosz Golaszewski --- drivers/mtd/nand/raw/ingenic/ingenic_nand_drv.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/mtd/nand/raw/ingenic/ingenic_nand_drv.c b/drivers/mtd/nand/raw/ingenic/ingenic_nand_drv.c index 6748226b8bd1..c055133c45fe 100644 --- a/drivers/mtd/nand/raw/ingenic/ingenic_nand_drv.c +++ b/drivers/mtd/nand/raw/ingenic/ingenic_nand_drv.c @@ -388,9 +388,8 @@ static int ingenic_nand_init_chip(struct platform_device *pdev, * here for older DTs so we can re-use the generic nand_gpio_waitrdy() * helper, and be consistent with what other drivers do. */ - if (of_machine_is_compatible("qi,lb60") && - gpiod_is_active_low(nand->busy_gpio)) - gpiod_toggle_active_low(nand->busy_gpio); + if (of_machine_is_compatible("qi,lb60")) + gpiod_set_active_high(nand->busy_gpio); nand->wp_gpio = devm_gpiod_get_optional(dev, "wp", GPIOD_OUT_LOW); From patchwork Wed Sep 13 11:49:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 722917 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 60746EDEC48 for ; Wed, 13 Sep 2023 11:50:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240559AbjIMLu3 (ORCPT ); Wed, 13 Sep 2023 07:50:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47174 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240556AbjIMLu0 (ORCPT ); Wed, 13 Sep 2023 07:50:26 -0400 Received: from mail-wr1-x431.google.com (mail-wr1-x431.google.com [IPv6:2a00:1450:4864:20::431]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A4CB7198B for ; Wed, 13 Sep 2023 04:50:22 -0700 (PDT) Received: by mail-wr1-x431.google.com with SMTP id ffacd0b85a97d-31f7638be6eso5938928f8f.3 for ; Wed, 13 Sep 2023 04:50:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1694605821; x=1695210621; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=9VygHWUUTxJcwgk20gKLWHe+YEMHPQx8FheNmwIckcQ=; b=it6XWD63NWzmlXIvizvgT6JCD9RWAoAEwGWTLHbrTB9cBevk2KasDN3Hvq/cBcMTci /GZ9Jwaj3xM6j67vzx0Iu70UkpbvB/MQox/v6wEkDAdFf3qXsl/3mZZZtqkS8bp8KuEy QUuoJeTzvYc38TIzguvRl1iCzvgBaQ8W41EclIJ/ZVpEn8pEHkEpd23pjO4K3N3wBM9H DDEOdS9C0jYoGRySHc9yWUKHEIFBjQOkH2f2nmNDbYsVShyXfoHVYa2xVDd4aSE/QwIg D7l1gyjKSb6urjJ+WXeDWMiGHlarDCCQMYTori2ay49npCywVbUYkzZA42ZXGjOj/3X9 Vcfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694605821; x=1695210621; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9VygHWUUTxJcwgk20gKLWHe+YEMHPQx8FheNmwIckcQ=; b=ayOKdO9Kgy2bI0BKAnHO5egbGNabnmZk58Ultr+zyF5ZERH3kF10PPs1hHHUyNJM1E lOVeKjJPH2kJDTzyTY63jYW8ky5IZlWJ8EoS2wxr1y+kUWOftGfMaFoptK7MKBYsyRBi 7a6FmpYatKQ/1PYbmLCyxx5HyOr/SsZfQtGBgegb/AEfkMdHJkTWKRhHGucEnE+7F3ir i9fI4YzGuW896kz0oqiGQANx0OvPDStIOcLuxRHddAes/3IiS7EQECK4RAgW1xsxEQBv gMDET8r07E1Fuk1UYBKKTNljeYK2l0Z7zdYX76zM+AMlexU00aR2X69zPWTtNIcvZJ8G QHVg== X-Gm-Message-State: AOJu0YwB0wAZmXtW+sAoTVTfVUm9+j5H9lkWJ9/Tja2VAj6KRUj5uCX7 DKTAZgbUQpWc2xyd5l28Gew0Sg== X-Google-Smtp-Source: AGHT+IE8/xUMx2CxEG3cqDJgSjbSA2NWMS00vPEgINZ0yvChOcoxgNUbEbPflHzcyEJln62XxJ5Bpg== X-Received: by 2002:a5d:5957:0:b0:314:12c:4322 with SMTP id e23-20020a5d5957000000b00314012c4322mr1948005wri.4.1694605821222; Wed, 13 Sep 2023 04:50:21 -0700 (PDT) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:3b50:bca5:a754:7463]) by smtp.gmail.com with ESMTPSA id j14-20020adfd20e000000b0031fc4c31d77sm1932689wrh.88.2023.09.13.04.50.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Sep 2023 04:50:20 -0700 (PDT) From: Bartosz Golaszewski To: Linus Walleij , Andy Shevchenko , Ulf Hansson , Paul Cercueil , Harvey Hunt , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Daniel Scally , Hans de Goede , Mark Gross , Heiner Kallweit Cc: 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 Subject: [PATCH 3/5] mmc: slot-gpio: use gpiod_set_active_[low|high]() Date: Wed, 13 Sep 2023 13:49:59 +0200 Message-Id: <20230913115001.23183-4-brgl@bgdev.pl> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230913115001.23183-1-brgl@bgdev.pl> References: <20230913115001.23183-1-brgl@bgdev.pl> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org From: Bartosz Golaszewski We have new, less cumbersome and clearer interfaces for controlling GPIO polarity. Use them in the MMC code. Signed-off-by: Bartosz Golaszewski --- drivers/mmc/core/slot-gpio.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/mmc/core/slot-gpio.c b/drivers/mmc/core/slot-gpio.c index 2a2d949a9344..a6fea6559a5e 100644 --- a/drivers/mmc/core/slot-gpio.c +++ b/drivers/mmc/core/slot-gpio.c @@ -204,12 +204,11 @@ int mmc_gpiod_request_cd(struct mmc_host *host, const char *con_id, } /* override forces default (active-low) polarity ... */ - if (override_active_level && !gpiod_is_active_low(desc)) - gpiod_toggle_active_low(desc); - + if (override_active_level) + gpiod_set_active_low(desc); /* ... or active-high */ - if (host->caps2 & MMC_CAP2_CD_ACTIVE_HIGH) - gpiod_toggle_active_low(desc); + else if (host->caps2 & MMC_CAP2_CD_ACTIVE_HIGH) + gpiod_set_active_high(desc); ctx->cd_gpio = desc; @@ -256,7 +255,7 @@ int mmc_gpiod_request_ro(struct mmc_host *host, const char *con_id, } if (host->caps2 & MMC_CAP2_RO_ACTIVE_HIGH) - gpiod_toggle_active_low(desc); + gpiod_set_active_high(desc); ctx->ro_gpio = desc; From patchwork Wed Sep 13 11:50:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 722401 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 4F223EDEC4E for ; Wed, 13 Sep 2023 11:50:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240613AbjIMLuc (ORCPT ); Wed, 13 Sep 2023 07:50:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47238 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240561AbjIMLu2 (ORCPT ); Wed, 13 Sep 2023 07:50:28 -0400 Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DAA6D1990 for ; Wed, 13 Sep 2023 04:50:23 -0700 (PDT) Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-401d2e11dacso5431275e9.0 for ; Wed, 13 Sep 2023 04:50:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1694605822; x=1695210622; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=jSDvgG/AlTocCbtsh72PpLY+FqxqCYIc4jmjYno6s+Q=; b=LPBaRxGKMqxZeVdBmAh6uE6kJYetpBgLfZaeQ5ZTeaAnb7dbPzxZMLpW6rKB8MTGET fn6QXEMiRSoXe7fZZnCMqoZSk5OnPd/EPLDMZ3I8m2J8cEyAUQ2tqqUzd6IhD75fhBT/ bnXfXL/3vO8x+ScWtCkhQK6+LRdN2uBXZo5RjcHixqOpCkFrZnEQ//PQRxwV0E6O83f4 9TR2TPo6vXwxRf03TkU8G/o/UA9C0QhBRuLvTsAD2fn5LEE/r9GB5PmOdp1tpSEkLaSD 71XMTllaBzKCrPwd7R0MhZTp7q8MG+5DjV/urg4o+eTVw8bqGmzliKPLWt6/rPmNG025 DFsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694605822; x=1695210622; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jSDvgG/AlTocCbtsh72PpLY+FqxqCYIc4jmjYno6s+Q=; b=bnCDdkTBWNRZ+UuAeFpPHDTinmamoMxPpAkDvkEJ9XpT9wdlvYH/OLYQRDCnhCAiGj I/TNBadEUGt/COQ1PeDfDzli55oe1+9Wwvon0jXhPRiisTvwW0RHYMV236reMnYtEq9d koiG/+Fjyji7rBUr0Z1oRDo6Zo1QPb6tvWn9bLBOC61EB8q+Xim9GJJGAimj7QT5vaxz ieSNMNXm4cRGFMLbxynig4YdHVhMdoscpf8Uhshr0XUFyqnansJ9YZPVamSJnGAqd/XR /6LVr35PiamPj6DQoBimI9QHqKwQ0P1iVvBv1MSougV5hmYSe3kaTLRmOMhBpgs1sp5S db3A== X-Gm-Message-State: AOJu0Yw8Ho1E4zLxeMTSLgPlOw5u9e2JLUfjidH0L/Lij/qOYnGqVdHT VwRUQHCwN/1Dbo8NOPbCendVRQ== X-Google-Smtp-Source: AGHT+IESxmTjjKwZ3Mmhzu2vYwbPTXYIyEeB82mrbgAnbchaF/ankGu50kRqPiQDLeOH4+3ZF+l1XA== X-Received: by 2002:adf:e885:0:b0:31f:9bd6:e8c3 with SMTP id d5-20020adfe885000000b0031f9bd6e8c3mr1744751wrm.22.1694605822422; Wed, 13 Sep 2023 04:50:22 -0700 (PDT) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:3b50:bca5:a754:7463]) by smtp.gmail.com with ESMTPSA id j14-20020adfd20e000000b0031fc4c31d77sm1932689wrh.88.2023.09.13.04.50.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Sep 2023 04:50:21 -0700 (PDT) From: Bartosz Golaszewski To: Linus Walleij , Andy Shevchenko , Ulf Hansson , Paul Cercueil , Harvey Hunt , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Daniel Scally , Hans de Goede , Mark Gross , Heiner Kallweit Cc: 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 Subject: [PATCH 4/5] platform/x86: int3472/discrete: use gpiod_set_active_low() Date: Wed, 13 Sep 2023 13:50:00 +0200 Message-Id: <20230913115001.23183-5-brgl@bgdev.pl> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230913115001.23183-1-brgl@bgdev.pl> References: <20230913115001.23183-1-brgl@bgdev.pl> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org From: Bartosz Golaszewski Use the new polarity setter instead of the more cumbersome toggle function. Signed-off-by: Bartosz Golaszewski Acked-by: Hans de Goede --- drivers/platform/x86/intel/int3472/clk_and_regulator.c | 2 +- drivers/platform/x86/intel/int3472/led.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/platform/x86/intel/int3472/clk_and_regulator.c b/drivers/platform/x86/intel/int3472/clk_and_regulator.c index ef4b3141efcd..31e520838b95 100644 --- a/drivers/platform/x86/intel/int3472/clk_and_regulator.c +++ b/drivers/platform/x86/intel/int3472/clk_and_regulator.c @@ -183,7 +183,7 @@ int skl_int3472_register_gpio_clock(struct int3472_discrete_device *int3472, } if (polarity == GPIO_ACTIVE_LOW) - gpiod_toggle_active_low(int3472->clock.ena_gpio); + gpiod_set_active_low(int3472->clock.ena_gpio); /* Ensure the pin is in output mode and non-active state */ gpiod_direction_output(int3472->clock.ena_gpio, 0); diff --git a/drivers/platform/x86/intel/int3472/led.c b/drivers/platform/x86/intel/int3472/led.c index bca1ce7d0d0c..46c9c569df5e 100644 --- a/drivers/platform/x86/intel/int3472/led.c +++ b/drivers/platform/x86/intel/int3472/led.c @@ -32,7 +32,7 @@ int skl_int3472_register_pled(struct int3472_discrete_device *int3472, "getting privacy LED GPIO\n"); if (polarity == GPIO_ACTIVE_LOW) - gpiod_toggle_active_low(int3472->pled.gpio); + gpiod_set_active_low(int3472->pled.gpio); /* Ensure the pin is in output mode and non-active state */ gpiod_direction_output(int3472->pled.gpio, 0); From patchwork Wed Sep 13 11:50:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 722916 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 CC9BBEDEC50 for ; Wed, 13 Sep 2023 11:50:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240558AbjIMLud (ORCPT ); Wed, 13 Sep 2023 07:50:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47280 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240570AbjIMLu3 (ORCPT ); Wed, 13 Sep 2023 07:50:29 -0400 Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3632019AD for ; Wed, 13 Sep 2023 04:50:25 -0700 (PDT) Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-401bbfc05fcso73793145e9.3 for ; Wed, 13 Sep 2023 04:50:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1694605823; x=1695210623; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Qakrc9HB1O5Iu/mhnl/aqGs6dWn+CSwn3hlAKhsYM7Q=; b=K59dYPUIHZTckXjn/bieXANY+l9Grc0I7HeuaZku2GSM0xmOT8f6oYUEL+r8A6Audd K64NQ5MSwHAEul4mNOjFFizn7isndvft5Yvjs6zvyP/88+zeF0dKiGOv00E/ikMfQZz2 sN9+grflFK8efEyxB98FD1NdNtAYJXREV0hWSBpiGmUUqbAyBUV2dxHJS9SI0PuWF2Ub hc9nyEwu4PnsWLwAfUxhp+xCQhUzgGlNnpT6vQqfOutJrw6eK0xFuAm4i8cPk4OrN4BE IocjF1H4qhRmDT70bfVHh3bEGn4sMAdQzii3oS91UoPKhvBB+IXXjwg/ozV21AYwFBPk HU7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694605823; x=1695210623; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Qakrc9HB1O5Iu/mhnl/aqGs6dWn+CSwn3hlAKhsYM7Q=; b=rV8yU9vzryiH16h4hcB8q6kSi9f3/6exi8zzkZ8cdiZL+HUPDC6Pg65WbIuJasYS+w NG2UlIYzD8Afsh6mKOPsO6/VYm03ZNF3Xs/at2d3Yw05pad1oHaTwWzZBr5RC++eS5BM peSH5xSYoByM7WldsXxT5rPZ5KsBBRYhyb+5byVQ+NUG8fU+fMjZg16TxvOTR71nQ+0K GzviX+G4SBAL1dyM+25NT9lTzKa5DQ6BHg0blbmIfHJwOat1Uu6Gq0OEO4Xw79q9BTwe u8pLGIx9Jg47x1ERRYMCraoFnGP3Xw4tYdtLzfr7+nkvgdzgL6m7acM/W1L2BIi1CZ2p Spug== X-Gm-Message-State: AOJu0Yy9zo5646U9LhB5uYmmhKI+1QU1zmtHKj3eb48fKYXmiA98gqWk pTWDRZu7A+gjQuema3PBnol/sLMGRdLQQbtXYOs= X-Google-Smtp-Source: AGHT+IHSaGvQEu7p/aPUxTrIpzTkMdMiNylYl6uXXTnV4TP4nHCU3quUTmCv138dyfMb7wv/N8jbvw== X-Received: by 2002:a5d:56ca:0:b0:311:1dba:ca65 with SMTP id m10-20020a5d56ca000000b003111dbaca65mr1878093wrw.51.1694605823533; Wed, 13 Sep 2023 04:50:23 -0700 (PDT) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:3b50:bca5:a754:7463]) by smtp.gmail.com with ESMTPSA id j14-20020adfd20e000000b0031fc4c31d77sm1932689wrh.88.2023.09.13.04.50.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Sep 2023 04:50:23 -0700 (PDT) From: Bartosz Golaszewski To: Linus Walleij , Andy Shevchenko , Ulf Hansson , Paul Cercueil , Harvey Hunt , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Daniel Scally , Hans de Goede , Mark Gross , Heiner Kallweit Cc: 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 Subject: [PATCH 5/5] gpiolib: remove gpiod_toggle_active_low() Date: Wed, 13 Sep 2023 13:50:01 +0200 Message-Id: <20230913115001.23183-6-brgl@bgdev.pl> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230913115001.23183-1-brgl@bgdev.pl> References: <20230913115001.23183-1-brgl@bgdev.pl> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org From: Bartosz Golaszewski With all users now having switched to gpiod_set_active_[low|high](), we can now remove gpiod_toggle_active_low(). Signed-off-by: Bartosz Golaszewski --- drivers/gpio/gpiolib.c | 11 ----------- include/linux/gpio/consumer.h | 7 ------- 2 files changed, 18 deletions(-) diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index 131965814a7c..14b84bad93ea 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -2714,17 +2714,6 @@ int gpiod_is_active_low(const struct gpio_desc *desc) } EXPORT_SYMBOL_GPL(gpiod_is_active_low); -/** - * gpiod_toggle_active_low - toggle whether a GPIO is active-low or not - * @desc: the gpio descriptor to change - */ -void gpiod_toggle_active_low(struct gpio_desc *desc) -{ - VALIDATE_DESC_VOID(desc); - change_bit(FLAG_ACTIVE_LOW, &desc->flags); -} -EXPORT_SYMBOL_GPL(gpiod_toggle_active_low); - /** * gpiod_set_active_low() - set the GPIO as active-low * @desc: the GPIO descriptor to set the active-low setting for diff --git a/include/linux/gpio/consumer.h b/include/linux/gpio/consumer.h index ddbf0d8e4a75..395e1a67c4c8 100644 --- a/include/linux/gpio/consumer.h +++ b/include/linux/gpio/consumer.h @@ -159,7 +159,6 @@ int gpiod_set_raw_array_value_cansleep(unsigned int array_size, int gpiod_set_config(struct gpio_desc *desc, unsigned long config); int gpiod_set_debounce(struct gpio_desc *desc, unsigned int debounce); -void gpiod_toggle_active_low(struct gpio_desc *desc); void gpiod_set_active_low(struct gpio_desc *desc); void gpiod_set_active_high(struct gpio_desc *desc); @@ -495,12 +494,6 @@ static inline int gpiod_set_debounce(struct gpio_desc *desc, unsigned int deboun return -ENOSYS; } -static inline void gpiod_toggle_active_low(struct gpio_desc *desc) -{ - /* GPIO can never have been requested */ - WARN_ON(desc); -} - static inline void gpiod_set_active_low(struct gpio_desc *desc { /* GPIO can never have been requested */