Commit 5981804b authored by Javier Martinez Canillas's avatar Javier Martinez Canillas Committed by Alexandre Belloni

rtc: max77686: Use usleep_range() instead of msleep()

Documentation/timers/timers-howto.txt suggest to use usleep_range()
instead of msleep() for small msec (1ms - 20ms) since msleep() will
often sleep for 20ms for any value in that range.

This is fine in this case since 16ms is the _minimum_ delay required
by max77686 for an RTC update but by using usleep_range() instead of
msleep(), the driver can support other RTC IP blocks with a shorter
minimum delay (i.e: in the range of usecs instead of msecs).
Signed-off-by: default avatarJavier Martinez Canillas <javier@osg.samsung.com>
Reviewed-by: default avatarKrzysztof Kozlowski <k.kozlowski@samsung.com>
Tested-by: default avatarKrzysztof Kozlowski <k.kozlowski@samsung.com>
Reviewed-by: default avatarAndi Shyti <andi.shyti@samsung.com>
Signed-off-by: default avatarAlexandre Belloni <alexandre.belloni@free-electrons.com>
parent 862f9453
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
#define ALARM_ENABLE_SHIFT 7 #define ALARM_ENABLE_SHIFT 7
#define ALARM_ENABLE_MASK (1 << ALARM_ENABLE_SHIFT) #define ALARM_ENABLE_MASK (1 << ALARM_ENABLE_SHIFT)
#define MAX77686_RTC_UPDATE_DELAY 16 #define MAX77686_RTC_UPDATE_DELAY 16000
enum { enum {
RTC_SEC = 0, RTC_SEC = 0,
...@@ -130,7 +130,8 @@ static int max77686_rtc_update(struct max77686_rtc_info *info, ...@@ -130,7 +130,8 @@ static int max77686_rtc_update(struct max77686_rtc_info *info,
__func__, ret, data); __func__, ret, data);
else { else {
/* Minimum 16ms delay required before RTC update. */ /* Minimum 16ms delay required before RTC update. */
msleep(MAX77686_RTC_UPDATE_DELAY); usleep_range(MAX77686_RTC_UPDATE_DELAY,
MAX77686_RTC_UPDATE_DELAY * 2);
} }
return ret; return ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment