Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

iio: dac: ds4424: use fsleep() instead of usleep_range()

The DS4422/DS4424 and DS4402/DS4404 datasheets do not specify a minimum
delay between power-up (POR) and the availability of the I2C interface.

The driver previously used `usleep_range(1000, 1200)` to enforce a ~1ms
delay. Replace this with `fsleep(1000)` to allow the kernel to select
the most efficient sleep mechanism while retaining the existing
conservative delay to ensure device readiness.

Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

authored by

Oleksij Rempel and committed by
Jonathan Cameron
5ff37a60 37840446

+8 -1
+8 -1
drivers/iio/dac/ds4424.c
··· 12 12 #include <linux/kernel.h> 13 13 #include <linux/module.h> 14 14 #include <linux/regulator/consumer.h> 15 + #include <linux/time64.h> 15 16 16 17 #include <linux/iio/driver.h> 17 18 #include <linux/iio/iio.h> ··· 245 244 return ret; 246 245 } 247 246 248 - usleep_range(1000, 1200); 247 + /* 248 + * The datasheet does not specify a power-up to I2C ready time. 249 + * Maintain the existing conservative 1ms delay to ensure the 250 + * device is ready for communication. 251 + */ 252 + fsleep(1 * USEC_PER_MSEC); 253 + 249 254 ret = ds4424_verify_chip(indio_dev); 250 255 if (ret < 0) 251 256 goto fail;