From patchwork Tue Sep 26 14:59:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 726456 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9D18B286B7 for ; Tue, 26 Sep 2023 14:59:55 +0000 (UTC) Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C6A3A11F for ; Tue, 26 Sep 2023 07:59:53 -0700 (PDT) Received: by mail-wr1-x436.google.com with SMTP id ffacd0b85a97d-3215f19a13aso8888926f8f.3 for ; Tue, 26 Sep 2023 07:59:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1695740392; x=1696345192; 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=9JlgJB8QI0EX98WcT+eE7uEPjq//nnV5NSDnPP83OC4=; b=QOEf7hjuT0l4WBz4752PrDciv1tUKsPuy3vsqzwR9P3r+SvYiiQdiyqoxcOBCU2nEz oCqKbDgvbwDt1BPuIRea7SAXZIOk5ArBt+X+BZi9X710A+OXLUblvhMY+QKvB4dzBgED 5TJ8MmN/L17oHo3FAk+xHPw+2OVXrxopLQPHKblC3uKs2clOEGDnJCUUvk3fCPxYYGoz fGGgYnO8bzNMbkjkReuRg5uJrmQrDFV/z1qB0UrHb9PWBns9UaH0yN8MZsh1zMloJNjH W1i9N0eZ+t60v3O97ArAgo/5gryTKaWbM9f8S47DyV7NtPKLOibDBO974ENjIyFBmPIL sdaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695740392; x=1696345192; 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=9JlgJB8QI0EX98WcT+eE7uEPjq//nnV5NSDnPP83OC4=; b=eXvCG7so9KIjrETArTvRpxMv4qCqjLo1oPfceRI2LN3d9Dg2/SMNqKEwdfC3aJUca8 +EdwGsRwyBT17qaPAHSAWjUbw0bJoCtaTbUa8PBYHx0utfSrVE1Pqk5TQi1jq4849tQo x4WEIEeyNPXTDkwcAwyt8Zm2bE65njwDMN0Bt5aA6j2OkqyWWPhNqgODxImvazFayp8a LgKccnP69+2jKqtW5Baow4hrItZPmYA5uRAMuG+zINW0q3YjEul1jAGL794L4Wu2/27N jhpKX/JO6lJfxebFQVaqo3bEJ7bsTccSOXYdUxPA8CX9E14bptsKM75N5Ncws5b5YLQe PVBg== X-Gm-Message-State: AOJu0YyrerZAZt+vo79fBkL5qPNCfzODwXdBBDcc2elW/GLMt8zRGqb+ 0ud3HnU25qHpkzNtdA/StLJeDg== X-Google-Smtp-Source: AGHT+IEry51pvRXcR/Bg3Ovg+pDmNC+cZF8nAceS0yECUnNz+7mE5ZPaS3ORz3jPT6CvosswbIBsEA== X-Received: by 2002:a5d:658b:0:b0:321:708d:3374 with SMTP id q11-20020a5d658b000000b00321708d3374mr8387415wru.3.1695740392138; Tue, 26 Sep 2023 07:59:52 -0700 (PDT) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:686:c497:30b1:d2b9]) by smtp.gmail.com with ESMTPSA id s2-20020a5d5102000000b0031f82743e25sm14871634wrt.67.2023.09.26.07.59.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Sep 2023 07:59:51 -0700 (PDT) From: Bartosz Golaszewski To: Mika Westerberg , Andy Shevchenko , Linus Walleij , Daniel Scally , Hans de Goede , Mark Gross Cc: linux-gpio@vger.kernel.org, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, platform-driver-x86@vger.kernel.org, Bartosz Golaszewski Subject: [RFT PATCH 1/4] platform/x86: int3472: provide a helper for getting GPIOs from lookups Date: Tue, 26 Sep 2023 16:59:40 +0200 Message-Id: <20230926145943.42814-2-brgl@bgdev.pl> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230926145943.42814-1-brgl@bgdev.pl> References: <20230926145943.42814-1-brgl@bgdev.pl> Precedence: bulk X-Mailing-List: linux-acpi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net From: Bartosz Golaszewski gpiod_toggle_active_low() should have never existed in the first place and once it was added, it should have never been used outside the MMC slot code. Stop using it in the int3472 driver and use temporary lookup tables instead. First: add a helper wrapping the common code in one function. Signed-off-by: Bartosz Golaszewski --- drivers/platform/x86/intel/int3472/common.c | 29 +++++++++++++++++++++ drivers/platform/x86/intel/int3472/common.h | 9 +++++++ 2 files changed, 38 insertions(+) diff --git a/drivers/platform/x86/intel/int3472/common.c b/drivers/platform/x86/intel/int3472/common.c index 9db2bb0bbba4..61a8240ed6db 100644 --- a/drivers/platform/x86/intel/int3472/common.c +++ b/drivers/platform/x86/intel/int3472/common.c @@ -2,6 +2,10 @@ /* Author: Dan Scally */ #include +#include +#include +#include +#include #include #include "common.h" @@ -80,3 +84,28 @@ int skl_int3472_get_sensor_adev_and_name(struct device *dev, return ret; } + +/* This should *really* only be used when there's no other way... */ +struct gpio_desc * +skl_int3472_gpiod_get_from_temp_lookup(struct device *dev, + const char *chip_label, u16 hwnum, + const char *con_id, + enum gpio_lookup_flags lflags, + enum gpiod_flags rflags) +{ + struct gpio_desc *desc; + + struct gpiod_lookup_table *lookup __free(kfree) = + kzalloc(struct_size(lookup, table, 1), GFP_KERNEL); + if (!lookup) + return ERR_PTR(-ENOMEM); + + lookup->dev_id = dev_name(dev); + lookup->table[0] = GPIO_LOOKUP(chip_label, hwnum, con_id, lflags); + + gpiod_add_lookup_table(lookup); + + desc = gpiod_get(dev, con_id, rflags); + gpiod_remove_lookup_table(lookup); + return desc; +} diff --git a/drivers/platform/x86/intel/int3472/common.h b/drivers/platform/x86/intel/int3472/common.h index 9f29baa13860..85ef9b630044 100644 --- a/drivers/platform/x86/intel/int3472/common.h +++ b/drivers/platform/x86/intel/int3472/common.h @@ -5,6 +5,8 @@ #define _INTEL_SKL_INT3472_H #include +#include +#include #include #include #include @@ -129,4 +131,11 @@ int skl_int3472_register_pled(struct int3472_discrete_device *int3472, struct acpi_resource_gpio *agpio, u32 polarity); void skl_int3472_unregister_pled(struct int3472_discrete_device *int3472); +struct gpio_desc * +skl_int3472_gpiod_get_from_temp_lookup(struct device *dev, + const char *chip_label, u16 hwnum, + const char *con_id, + enum gpio_lookup_flags lflags, + enum gpiod_flags rflags); + #endif From patchwork Tue Sep 26 14:59:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 727159 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D6BB310EF for ; Tue, 26 Sep 2023 14:59:56 +0000 (UTC) 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 AD7D3126 for ; Tue, 26 Sep 2023 07:59:54 -0700 (PDT) Received: by mail-wr1-x431.google.com with SMTP id ffacd0b85a97d-3214d4ecd39so7686171f8f.1 for ; Tue, 26 Sep 2023 07:59:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1695740393; x=1696345193; 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=LOR2X/AoUnTx42nPhZDbyArkpmdX3bsMYj2lZRsFUms=; b=zOZwMSAXHjeLQGWcL2Uhltnz2hlI7XNV9ewI0AYTJIyufx2fw5+odUKZX3SF3OdVo2 UlQEE0zam+rMuUY+dmj78myXlrMmWSkfn37NQb+yQn2yRzuAYt1mHQeX69fRpj3LWgoq DnRkDh1CFa3VtNEjAJi12cVCeQPSzMIuLFEBnrWlbPdaoXkN0akjsISOdCiNgMPoHRLF r7kNO0MescDjiY5P31lLEnDKROy/OtDt6ZI8ox9V10HkOMJPo00rSnEjLYDdN9ij1f9G l36r3oZGDy/tqplSiP6d6VejCSKVhHopDn8QC2mOJlzpGtJlbgtq+H3NJEoLoy5x/ooi jU0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695740393; x=1696345193; 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=LOR2X/AoUnTx42nPhZDbyArkpmdX3bsMYj2lZRsFUms=; b=mCmlDwNO24aQ/NK/rfE376BlOo8i90uhobQuC/XZ6PtPi6xTQXIK5BJMNMPQATiZiM vipJ9ahgQIO4gUk0WB7SmDD6a4lQ5XrcZI0D3TevLlknbplaV0HOqt3K4jrcKn3nj+Va QXxgXN2nfMOtefl5YSQRx+ZaxkrMtOoUEjZNG1r5jIHAqdTdckH1bQQr70DDZC+olLHE Dy0zsygohMXO1FUrlRLg6SuJj97zs6mPMLa7DKqE0j6Zd2cYF9qjh5A/Zy+mbKfZBqq1 uM7t8dYW02xXmgv33Sz62Gvxm0c4kqlhQkLBrwNex2q9P4YYfW2rUSeFXZMnaM1ceTs7 im3Q== X-Gm-Message-State: AOJu0Yzxs36NVjV3sWedzEPs5B0eNXRQDkck0HRJGQ6ux1EyHzhLn/Qo TdqioMNE7WmDucVq9r8NnCRscw== X-Google-Smtp-Source: AGHT+IFvuYKk7b6vwmISUaGLDlo/gV93nTCl+wOrw03xkUp5qRrel4E8uHLcxNK3RPdoDpL8HMIuqw== X-Received: by 2002:adf:f044:0:b0:319:7134:a3cf with SMTP id t4-20020adff044000000b003197134a3cfmr9483453wro.31.1695740393042; Tue, 26 Sep 2023 07:59:53 -0700 (PDT) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:686:c497:30b1:d2b9]) by smtp.gmail.com with ESMTPSA id s2-20020a5d5102000000b0031f82743e25sm14871634wrt.67.2023.09.26.07.59.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Sep 2023 07:59:52 -0700 (PDT) From: Bartosz Golaszewski To: Mika Westerberg , Andy Shevchenko , Linus Walleij , Daniel Scally , Hans de Goede , Mark Gross Cc: linux-gpio@vger.kernel.org, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, platform-driver-x86@vger.kernel.org, Bartosz Golaszewski Subject: [RFT PATCH 2/4] platform/x86: int3472: led: don't use gpiod_toggle_active_low() Date: Tue, 26 Sep 2023 16:59:41 +0200 Message-Id: <20230926145943.42814-3-brgl@bgdev.pl> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230926145943.42814-1-brgl@bgdev.pl> References: <20230926145943.42814-1-brgl@bgdev.pl> Precedence: bulk X-Mailing-List: linux-acpi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net From: Bartosz Golaszewski Instead of acpi_get_and_request_gpiod() + gpiod_toggle_active_low(), use temporary lookup tables with appropriate lookup flags. Signed-off-by: Bartosz Golaszewski --- drivers/platform/x86/intel/int3472/led.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/platform/x86/intel/int3472/led.c b/drivers/platform/x86/intel/int3472/led.c index bca1ce7d0d0c..62e0cd5207a7 100644 --- a/drivers/platform/x86/intel/int3472/led.c +++ b/drivers/platform/x86/intel/int3472/led.c @@ -25,18 +25,14 @@ int skl_int3472_register_pled(struct int3472_discrete_device *int3472, if (int3472->pled.classdev.dev) return -EBUSY; - int3472->pled.gpio = acpi_get_and_request_gpiod(path, agpio->pin_table[0], - "int3472,privacy-led"); + int3472->pled.gpio = skl_int3472_gpiod_get_from_temp_lookup( + int3472->dev, path, agpio->pin_table[0], + "int3472,privacy-led", polarity, + GPIOD_OUT_LOW); if (IS_ERR(int3472->pled.gpio)) return dev_err_probe(int3472->dev, PTR_ERR(int3472->pled.gpio), "getting privacy LED GPIO\n"); - if (polarity == GPIO_ACTIVE_LOW) - gpiod_toggle_active_low(int3472->pled.gpio); - - /* Ensure the pin is in output mode and non-active state */ - gpiod_direction_output(int3472->pled.gpio, 0); - /* Generate the name, replacing the ':' in the ACPI devname with '_' */ snprintf(int3472->pled.name, sizeof(int3472->pled.name), "%s::privacy_led", acpi_dev_name(int3472->sensor)); From patchwork Tue Sep 26 14:59:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 726455 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2AC7A28E20 for ; Tue, 26 Sep 2023 14:59:57 +0000 (UTC) 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 791B3139 for ; Tue, 26 Sep 2023 07:59:55 -0700 (PDT) Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-405497850dbso70908345e9.0 for ; Tue, 26 Sep 2023 07:59:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1695740394; x=1696345194; 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=95OtrKREF8DsDqawHPxVwUVS1xHqZyiLo+RbQA771N0=; b=w4ZxVzxqVCw4qjgnYaUWgjZiZ016hC+aZ3J5ft8os76UZ3+SpjZEUYYUqJx8S/PUm1 hJzpz3PkJcRFX+7IvPfutngdq56J/H+jMnPhaoPysmc4Cb/1teL4yi0biPWA3yom6LD2 IgsPVS9ps/GpLPkMU7AQMOj/xyKC79ID7av5cJCzt5K7X1qMqpUIHxX7EqpBAUi1Sm7L I2kM6WB2rlsfA/z7Cim9HzJon3X4w67OMGmaRPfHeinzXvThbOXmLDVZETuokriRt0nd FBLj3mIXozbwELB/6XvMziXDc+rh3mMIadt/4pmE7o6gYoarfc7aWNHDE6ivrzbEoLgy 37Mg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695740394; x=1696345194; 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=95OtrKREF8DsDqawHPxVwUVS1xHqZyiLo+RbQA771N0=; b=r+6UhAnl9bv8vKFy1/r1GC2UQ8sdXK4UifL8G1auDYEpQjRjVvgnf6kekjWO2gjqVs Qqi/3KA7K6WSJ1p46dRAdcbwcbVE0hIquE1avhaLylDYTIw81+aL8TQjA8DEXHDC8JKt RCNXJBBZCsgHPcvbGHVQbEVfVYc3xNPLiaTBBXiFqMmmYndqCZHt3Lfz0SKr5YDK8U8Z yrWqkMMSAMtH8LGBG+PnyjnvzPqHxLMPjo1cBzMVfY+5WrMA//oN1wV1Hq4OJe9b7DHN qRIPzXt61ZB/ZasGYkEuznFEnCUJyXDKF7185tAoFxPXLo8j3izLf+/X8Bc0WlnVjctB Cidw== X-Gm-Message-State: AOJu0Yxdh3hpLtUi+r/0N2RGj+ZWlgdlYzK8OYPMHD4jIK6y6GkpaXBL pG/GhlxNvjLzGhAMGoUinEovNA== X-Google-Smtp-Source: AGHT+IHI0VIKUHq7lfQylc1Bgqtnm9G/0hKS8DqAmHAu9aN6x76YmqNYZiupYJpDJhSqidCGXyqjpA== X-Received: by 2002:adf:ff8c:0:b0:317:ef76:b773 with SMTP id j12-20020adfff8c000000b00317ef76b773mr8594149wrr.45.1695740393987; Tue, 26 Sep 2023 07:59:53 -0700 (PDT) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:686:c497:30b1:d2b9]) by smtp.gmail.com with ESMTPSA id s2-20020a5d5102000000b0031f82743e25sm14871634wrt.67.2023.09.26.07.59.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Sep 2023 07:59:53 -0700 (PDT) From: Bartosz Golaszewski To: Mika Westerberg , Andy Shevchenko , Linus Walleij , Daniel Scally , Hans de Goede , Mark Gross Cc: linux-gpio@vger.kernel.org, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, platform-driver-x86@vger.kernel.org, Bartosz Golaszewski Subject: [RFT PATCH 3/4] platform/x86: int3472: clk_and_regulator: use GPIO lookup tables Date: Tue, 26 Sep 2023 16:59:42 +0200 Message-Id: <20230926145943.42814-4-brgl@bgdev.pl> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230926145943.42814-1-brgl@bgdev.pl> References: <20230926145943.42814-1-brgl@bgdev.pl> Precedence: bulk X-Mailing-List: linux-acpi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net From: Bartosz Golaszewski Instead of acpi_get_and_request_gpiod() + gpiod_toggle_active_low(), use temporary lookup tables with appropriate lookup flags. Signed-off-by: Bartosz Golaszewski --- .../x86/intel/int3472/clk_and_regulator.c | 22 ++++++++----------- 1 file changed, 9 insertions(+), 13 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..ec4c4848a2c4 100644 --- a/drivers/platform/x86/intel/int3472/clk_and_regulator.c +++ b/drivers/platform/x86/intel/int3472/clk_and_regulator.c @@ -174,20 +174,16 @@ int skl_int3472_register_gpio_clock(struct int3472_discrete_device *int3472, if (int3472->clock.cl) return -EBUSY; - int3472->clock.ena_gpio = acpi_get_and_request_gpiod(path, agpio->pin_table[0], - "int3472,clk-enable"); + int3472->clock.ena_gpio = skl_int3472_gpiod_get_from_temp_lookup( + int3472->dev, path, agpio->pin_table[0], + "int3472,clk-enable", polarity, + GPIOD_OUT_LOW); if (IS_ERR(int3472->clock.ena_gpio)) { ret = PTR_ERR(int3472->clock.ena_gpio); int3472->clock.ena_gpio = NULL; return dev_err_probe(int3472->dev, ret, "getting clk-enable GPIO\n"); } - if (polarity == GPIO_ACTIVE_LOW) - gpiod_toggle_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); - init.name = kasprintf(GFP_KERNEL, "%s-clk", acpi_dev_name(int3472->adev)); if (!init.name) { @@ -314,17 +310,17 @@ int skl_int3472_register_regulator(struct int3472_discrete_device *int3472, int3472->regulator.supply_name, &int3472_gpio_regulator_ops); - int3472->regulator.gpio = acpi_get_and_request_gpiod(path, agpio->pin_table[0], - "int3472,regulator"); + /* Ensure the pin is in output mode and non-active state */ + int3472->regulator.gpio = skl_int3472_gpiod_get_from_temp_lookup( + int3472->dev, path, agpio->pin_table[0], + "int3472,regulator", GPIO_ACTIVE_HIGH, + GPIOD_OUT_LOW); if (IS_ERR(int3472->regulator.gpio)) { ret = PTR_ERR(int3472->regulator.gpio); int3472->regulator.gpio = NULL; return dev_err_probe(int3472->dev, ret, "getting regulator GPIO\n"); } - /* Ensure the pin is in output mode and non-active state */ - gpiod_direction_output(int3472->regulator.gpio, 0); - cfg.dev = &int3472->adev->dev; cfg.init_data = &init_data; cfg.ena_gpiod = int3472->regulator.gpio; From patchwork Tue Sep 26 14:59:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 727158 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5FDBD286B7 for ; Tue, 26 Sep 2023 14:59:58 +0000 (UTC) Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5328811D for ; Tue, 26 Sep 2023 07:59:56 -0700 (PDT) Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-40572aeb673so59494005e9.0 for ; Tue, 26 Sep 2023 07:59:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1695740395; x=1696345195; 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=HNGK0v08+zzpQuwoBoXMljpypDBn+BJlECyJC5l0N4Y=; b=y8aV3sl/654U3FoYohmH++rkk2HdgHwQxSCApQc7CvTvnkS7DXX0+VG009UypeeXBH o98O++bbLGXSezK6Ttg/lCCchVVejqj1azQZZoPYvSyhTPBsSSS7IFhnR9xUr9F9vf5g klVnOgQVovYOeECWZmMiJMhrmZDR6qu8+/HDcWCKWZ6pX0fo4hSHlVFI8Xh15nMh9sYg M8FWJlNs2cw5DsdnQoEIEnVSvpjrHmR/H7OzAUY2cJ7Sq23O4mxPrvxKa8A4fkIw69nT v/348kPXJ8HF4ePd7C1Jk+oHRGpDo0LKFEhqbsOHA4Aekr0X4bu3DHLtyso3u2T7vVdS ULQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695740395; x=1696345195; 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=HNGK0v08+zzpQuwoBoXMljpypDBn+BJlECyJC5l0N4Y=; b=WI1c85pSG4eu1/mmxWgDBcWwZmzks3TANwQiZ7i3HN0vPaoiHsdMQsKv4yl0LYa1Ys C7ODNqV95qsx5zdL34admLeP695/y96ureIINkTT6Jjr0Z7y9/kESfvXsbr4HEUO4o4L 7upa6N/0pDhy4sTOOi7JB2e30AxUQxyy15xDernuFMlUnPCa4mT3QazDSKSzOYsjQQ/U D4yxKaCsJevPehvGi6j77UonsSZGsbNK0W3aX2QJ1HOH8HeXxnMqckDHOuO0VObYdTHv 9bk+3XZ87CnUfFs29tVZFdEmhRrI4rjlzHXlm73/AZ4WPhFW7y4fE2giGuBhPI/lMs7b GmzA== X-Gm-Message-State: AOJu0YwYo8ov0PdySCIRr9uLE5xB6DSAFEoEblm49LautLGJoryRl8ig /r0gfoqj2Fiwdd+QA9k2yrMeLQ== X-Google-Smtp-Source: AGHT+IEOH4p3qhvyQQt5ZYpZ/mQ1vxTnsYtUtTM2fHWFYi8sXoPXL21yjgXMCK7N2nHUIBl2/l7VVw== X-Received: by 2002:a05:600c:216:b0:401:b2c7:34a8 with SMTP id 22-20020a05600c021600b00401b2c734a8mr8423804wmi.7.1695740394843; Tue, 26 Sep 2023 07:59:54 -0700 (PDT) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:686:c497:30b1:d2b9]) by smtp.gmail.com with ESMTPSA id s2-20020a5d5102000000b0031f82743e25sm14871634wrt.67.2023.09.26.07.59.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Sep 2023 07:59:54 -0700 (PDT) From: Bartosz Golaszewski To: Mika Westerberg , Andy Shevchenko , Linus Walleij , Daniel Scally , Hans de Goede , Mark Gross Cc: linux-gpio@vger.kernel.org, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, platform-driver-x86@vger.kernel.org, Bartosz Golaszewski Subject: [RFT PATCH 4/4] gpio: acpi: remove acpi_get_and_request_gpiod() Date: Tue, 26 Sep 2023 16:59:43 +0200 Message-Id: <20230926145943.42814-5-brgl@bgdev.pl> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230926145943.42814-1-brgl@bgdev.pl> References: <20230926145943.42814-1-brgl@bgdev.pl> Precedence: bulk X-Mailing-List: linux-acpi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net From: Bartosz Golaszewski With no more users, we can remove acpi_get_and_request_gpiod(). Signed-off-by: Bartosz Golaszewski --- drivers/gpio/gpiolib-acpi.c | 28 ---------------------------- include/linux/gpio/consumer.h | 8 -------- 2 files changed, 36 deletions(-) diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c index 17a86bdd9609..89ff93f3b579 100644 --- a/drivers/gpio/gpiolib-acpi.c +++ b/drivers/gpio/gpiolib-acpi.c @@ -158,34 +158,6 @@ static struct gpio_desc *acpi_get_gpiod(char *path, unsigned int pin) return gpiochip_get_desc(chip, pin); } -/** - * acpi_get_and_request_gpiod - Translate ACPI GPIO pin to GPIO descriptor and - * hold a refcount to the GPIO device. - * @path: ACPI GPIO controller full path name, (e.g. "\\_SB.GPO1") - * @pin: ACPI GPIO pin number (0-based, controller-relative) - * @label: Label to pass to gpiod_request() - * - * This function is a simple pass-through to acpi_get_gpiod(), except that - * as it is intended for use outside of the GPIO layer (in a similar fashion to - * gpiod_get_index() for example) it also holds a reference to the GPIO device. - */ -struct gpio_desc *acpi_get_and_request_gpiod(char *path, unsigned int pin, char *label) -{ - struct gpio_desc *gpio; - int ret; - - gpio = acpi_get_gpiod(path, pin); - if (IS_ERR(gpio)) - return gpio; - - ret = gpiod_request(gpio, label); - if (ret) - return ERR_PTR(ret); - - return gpio; -} -EXPORT_SYMBOL_GPL(acpi_get_and_request_gpiod); - static irqreturn_t acpi_gpio_irq_handler(int irq, void *data) { struct acpi_gpio_event *event = data; diff --git a/include/linux/gpio/consumer.h b/include/linux/gpio/consumer.h index 6cc345440a5b..db2dfbae8edb 100644 --- a/include/linux/gpio/consumer.h +++ b/include/linux/gpio/consumer.h @@ -606,8 +606,6 @@ void acpi_dev_remove_driver_gpios(struct acpi_device *adev); int devm_acpi_dev_add_driver_gpios(struct device *dev, const struct acpi_gpio_mapping *gpios); -struct gpio_desc *acpi_get_and_request_gpiod(char *path, unsigned int pin, char *label); - #else /* CONFIG_GPIOLIB && CONFIG_ACPI */ #include @@ -625,12 +623,6 @@ static inline int devm_acpi_dev_add_driver_gpios(struct device *dev, return -ENXIO; } -static inline struct gpio_desc *acpi_get_and_request_gpiod(char *path, unsigned int pin, - char *label) -{ - return ERR_PTR(-ENOSYS); -} - #endif /* CONFIG_GPIOLIB && CONFIG_ACPI */ From patchwork Thu Sep 28 12:45:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 727139 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2E7468BF4 for ; Thu, 28 Sep 2023 12:45:59 +0000 (UTC) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9EAF91AD for ; Thu, 28 Sep 2023 05:45:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1695905156; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ACdKckhs2IGUtv5AveDwU/IL9fYWvBeI2aPkdMd1dhI=; b=Mb0DhrS2dQCLHBuvdSxJLORbSDm5z8iWjnlATXhNvf0yEY76hYDh5FrZsW5MlfitvqPn+s ZJzzlOhLxhmu5FEVgJ0kcKPc/TMOm5tS8me8fAhJ8L9yMyjUR00sj+c8qXBgzg4gpppc2I DDHQE5ItkCDZXAIoVrRlPkWAFNPVinU= Received: from mail-ej1-f72.google.com (mail-ej1-f72.google.com [209.85.218.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-518-vXBRe6I6M9m23RrPM9f4Aw-1; Thu, 28 Sep 2023 08:45:55 -0400 X-MC-Unique: vXBRe6I6M9m23RrPM9f4Aw-1 Received: by mail-ej1-f72.google.com with SMTP id a640c23a62f3a-9a5d86705e4so1130224366b.1 for ; Thu, 28 Sep 2023 05:45:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695905154; x=1696509954; h=content-transfer-encoding:in-reply-to:references:cc:to:from :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ACdKckhs2IGUtv5AveDwU/IL9fYWvBeI2aPkdMd1dhI=; b=WIMKAxADOc4kRqsourY6m5GgnEFBGg+ZZDav6NmaVv+TPylCde/QdUjoXt/nbpZ+zq U9W56IIU4aksn45hA7CRvO4WlyX7wJL1warVNE/7Puxet7QyUYcInxYBw6Hl8Kmy7osm AjwljW/iPTLFcr5hM3PmluuBxrNiDTixJqnC5QC3fdWEBKoAo8grqJd8dshW+M/nv06P f55mxN+FUNT97Fxmdz6qnsru1uXtK6QVt/IHDvpwz+AAASVknSpZFmxvGiSN9klIjc52 NNtTdERG3RyRbxmQ34tSSqE5s5nk1MLxflZDCzO+y2UrMdzi8xA7dqM7vZGOWHUju6M+ X7+w== X-Gm-Message-State: AOJu0YxAQFmRdV+BGwuhho0sUbf/+c0MeAVP86awWu/rtLzBX4XYG3tY DtDSVMzKSGl50wfkXQfvHt5eEu6MBRIoTMzhe94wuFrK5EYTZ5Df0D2nJf/u/DpQ9wEPDLJpD1c eVXrVlXM0BZ155pL83Zoa0g== X-Received: by 2002:a17:906:3150:b0:9ae:696c:2c43 with SMTP id e16-20020a170906315000b009ae696c2c43mr1183232eje.28.1695905154395; Thu, 28 Sep 2023 05:45:54 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHQnYwpJz4FRm5OEctCUqntpuOgB3RgSDa5zxu4Q3oNPpnc3WMFQcTzGCzOVBYL6EaWeUHW8A== X-Received: by 2002:a17:906:3150:b0:9ae:696c:2c43 with SMTP id e16-20020a170906315000b009ae696c2c43mr1183223eje.28.1695905154189; Thu, 28 Sep 2023 05:45:54 -0700 (PDT) Received: from [192.168.1.217] ([109.36.138.103]) by smtp.gmail.com with ESMTPSA id lw13-20020a170906bccd00b0098884f86e41sm10683387ejb.123.2023.09.28.05.45.52 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 28 Sep 2023 05:45:53 -0700 (PDT) Message-ID: <93be52fc-fa87-423f-dde2-1b0b758ab632@redhat.com> Date: Thu, 28 Sep 2023 14:45:51 +0200 Precedence: bulk X-Mailing-List: linux-acpi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: [PATCH v2 5/5] gpio: acpi: remove acpi_get_and_request_gpiod() Content-Language: en-US From: Hans de Goede To: Bartosz Golaszewski , Mika Westerberg , Andy Shevchenko , Linus Walleij , Daniel Scally , Mark Gross Cc: linux-gpio@vger.kernel.org, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, platform-driver-x86@vger.kernel.org, Bartosz Golaszewski References: <20230926145943.42814-1-brgl@bgdev.pl> In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net With no more users, we can remove acpi_get_and_request_gpiod(). Signed-off-by: Bartosz Golaszewski Link: https://lore.kernel.org/r/20230926145943.42814-5-brgl@bgdev.pl Signed-off-by: Hans de Goede --- drivers/gpio/gpiolib-acpi.c | 28 ---------------------------- include/linux/gpio/consumer.h | 8 -------- 2 files changed, 36 deletions(-) diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c index 17a86bdd9609..89ff93f3b579 100644 --- a/drivers/gpio/gpiolib-acpi.c +++ b/drivers/gpio/gpiolib-acpi.c @@ -158,34 +158,6 @@ static struct gpio_desc *acpi_get_gpiod(char *path, unsigned int pin) return gpiochip_get_desc(chip, pin); } -/** - * acpi_get_and_request_gpiod - Translate ACPI GPIO pin to GPIO descriptor and - * hold a refcount to the GPIO device. - * @path: ACPI GPIO controller full path name, (e.g. "\\_SB.GPO1") - * @pin: ACPI GPIO pin number (0-based, controller-relative) - * @label: Label to pass to gpiod_request() - * - * This function is a simple pass-through to acpi_get_gpiod(), except that - * as it is intended for use outside of the GPIO layer (in a similar fashion to - * gpiod_get_index() for example) it also holds a reference to the GPIO device. - */ -struct gpio_desc *acpi_get_and_request_gpiod(char *path, unsigned int pin, char *label) -{ - struct gpio_desc *gpio; - int ret; - - gpio = acpi_get_gpiod(path, pin); - if (IS_ERR(gpio)) - return gpio; - - ret = gpiod_request(gpio, label); - if (ret) - return ERR_PTR(ret); - - return gpio; -} -EXPORT_SYMBOL_GPL(acpi_get_and_request_gpiod); - static irqreturn_t acpi_gpio_irq_handler(int irq, void *data) { struct acpi_gpio_event *event = data; diff --git a/include/linux/gpio/consumer.h b/include/linux/gpio/consumer.h index 1c4385a00f88..9d1f598b8971 100644 --- a/include/linux/gpio/consumer.h +++ b/include/linux/gpio/consumer.h @@ -614,8 +614,6 @@ void acpi_dev_remove_driver_gpios(struct acpi_device *adev); int devm_acpi_dev_add_driver_gpios(struct device *dev, const struct acpi_gpio_mapping *gpios); -struct gpio_desc *acpi_get_and_request_gpiod(char *path, unsigned int pin, char *label); - #else /* CONFIG_GPIOLIB && CONFIG_ACPI */ #include @@ -633,12 +631,6 @@ static inline int devm_acpi_dev_add_driver_gpios(struct device *dev, return -ENXIO; } -static inline struct gpio_desc *acpi_get_and_request_gpiod(char *path, unsigned int pin, - char *label) -{ - return ERR_PTR(-ENOSYS); -} - #endif /* CONFIG_GPIOLIB && CONFIG_ACPI */