[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230926145943.42814-4-brgl@bgdev.pl>
Date: Tue, 26 Sep 2023 16:59:42 +0200
From: Bartosz Golaszewski <brgl@...ev.pl>
To: Mika Westerberg <mika.westerberg@...ux.intel.com>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Linus Walleij <linus.walleij@...aro.org>,
Daniel Scally <djrscally@...il.com>,
Hans de Goede <hdegoede@...hat.com>,
Mark Gross <markgross@...nel.org>
Cc: linux-gpio@...r.kernel.org, linux-acpi@...r.kernel.org,
linux-kernel@...r.kernel.org, platform-driver-x86@...r.kernel.org,
Bartosz Golaszewski <bartosz.golaszewski@...aro.org>
Subject: [RFT PATCH 3/4] platform/x86: int3472: clk_and_regulator: use GPIO lookup tables
From: Bartosz Golaszewski <bartosz.golaszewski@...aro.org>
Instead of acpi_get_and_request_gpiod() + gpiod_toggle_active_low(), use
temporary lookup tables with appropriate lookup flags.
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@...aro.org>
---
.../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;
--
2.39.2
Powered by blists - more mailing lists