summaryrefslogtreecommitdiffstats
path: root/drivers/pinctrl
diff options
context:
space:
mode:
authorAndy Shevchenko <andy.shevchenko@gmail.com>2024-11-10 21:59:43 +0100
committerLinus Walleij <linus.walleij@linaro.org>2024-11-13 14:18:06 +0100
commitf8bd5383d8b67e08153123718d0fb6e92a70f838 (patch)
treee0a1c86101e96304f8cf8dcf2d78189915042b4a /drivers/pinctrl
parentpinctrl: cy8c95x0: switch to using devm_regulator_get_enable() (diff)
downloadlinux-f8bd5383d8b67e08153123718d0fb6e92a70f838.tar.xz
linux-f8bd5383d8b67e08153123718d0fb6e92a70f838.zip
pinctrl: cy8c95x0: use flexible sleeping in reset function
The device reset assert and deassert length was created by usleep_range() but that does not ensure optimal handling of all the different values from device tree properties. By switching to the new flexible sleeping helper function, fsleep(), the correct delay function is called depending on delay length, e.g. udelay(), usleep_range() or msleep(). While at it, move out GPIO consumer name setting of the reset conditional, the all necessary checks are already done there, so logically that call is not related to the reset sequence. Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com> Link: https://lore.kernel.org/20241110210040.18918-4-andy.shevchenko@gmail.com Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/pinctrl')
-rw-r--r--drivers/pinctrl/pinctrl-cy8c95x0.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/pinctrl/pinctrl-cy8c95x0.c b/drivers/pinctrl/pinctrl-cy8c95x0.c
index cb6d9458c1e8..54b080f63226 100644
--- a/drivers/pinctrl/pinctrl-cy8c95x0.c
+++ b/drivers/pinctrl/pinctrl-cy8c95x0.c
@@ -1475,12 +1475,11 @@ static int cy8c95x0_probe(struct i2c_client *client)
chip->gpio_reset = devm_gpiod_get_optional(&client->dev, "reset", GPIOD_OUT_HIGH);
if (IS_ERR(chip->gpio_reset))
return dev_err_probe(chip->dev, PTR_ERR(chip->gpio_reset), "Failed to get GPIO 'reset'\n");
+ gpiod_set_consumer_name(chip->gpio_reset, "CY8C95X0 RESET");
if (chip->gpio_reset) {
- usleep_range(1000, 2000);
+ fsleep(1000);
gpiod_set_value_cansleep(chip->gpio_reset, 0);
- usleep_range(250000, 300000);
-
- gpiod_set_consumer_name(chip->gpio_reset, "CY8C95X0 RESET");
+ fsleep(250000);
}
/* Regmap for direct and paged registers */