Skip to content

Commit f8bd538

Browse files
andy-shevlinusw
authored andcommitted
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 <[email protected]> Link: https://lore.kernel.org/[email protected] Signed-off-by: Linus Walleij <[email protected]>
1 parent c13411c commit f8bd538

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

drivers/pinctrl/pinctrl-cy8c95x0.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1475,12 +1475,11 @@ static int cy8c95x0_probe(struct i2c_client *client)
14751475
chip->gpio_reset = devm_gpiod_get_optional(&client->dev, "reset", GPIOD_OUT_HIGH);
14761476
if (IS_ERR(chip->gpio_reset))
14771477
return dev_err_probe(chip->dev, PTR_ERR(chip->gpio_reset), "Failed to get GPIO 'reset'\n");
1478+
gpiod_set_consumer_name(chip->gpio_reset, "CY8C95X0 RESET");
14781479
if (chip->gpio_reset) {
1479-
usleep_range(1000, 2000);
1480+
fsleep(1000);
14801481
gpiod_set_value_cansleep(chip->gpio_reset, 0);
1481-
usleep_range(250000, 300000);
1482-
1483-
gpiod_set_consumer_name(chip->gpio_reset, "CY8C95X0 RESET");
1482+
fsleep(250000);
14841483
}
14851484

14861485
/* Regmap for direct and paged registers */

0 commit comments

Comments
 (0)