Skip to content

Commit c36d34b

Browse files
lategoodbyepelwell
authored andcommitted
watchdog: bcm2835_wdt: Fix WDIOC_SETTIMEOUT handling
Users report about the unexpected behavior for setting timeouts above 15 sec on Raspberry Pi. According to watchdog-api.rst the ioctl WDIOC_SETTIMEOUT shouldn't fail because of hardware limitations. But looking at the code shows that max_timeout based on the register value PM_WDOG_TIME_SET, which is the maximum. Since 664a392 ("watchdog: Introduce hardware maximum heartbeat in watchdog core") the watchdog core is able to handle this problem. This fix has been tested with watchdog-test from selftests. Link: https://bugzilla.kernel.org/show_bug.cgi?id=217374 Fixes: 664a392 ("watchdog: Introduce hardware maximum heartbeat in watchdog core") Signed-off-by: Stefan Wahren <[email protected]>
1 parent 1e56389 commit c36d34b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/watchdog/bcm2835_wdt.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636

3737
#define SECS_TO_WDOG_TICKS(x) ((x) << 16)
3838
#define WDOG_TICKS_TO_SECS(x) ((x) >> 16)
39+
#define WDOG_TICKS_TO_MSECS(x) ((x) * 1000 >> 16)
3940

4041
struct bcm2835_wdt {
4142
void __iomem *base;
@@ -157,7 +158,7 @@ static struct watchdog_device bcm2835_wdt_wdd = {
157158
.info = &bcm2835_wdt_info,
158159
.ops = &bcm2835_wdt_ops,
159160
.min_timeout = 1,
160-
.max_timeout = WDOG_TICKS_TO_SECS(PM_WDOG_TIME_SET),
161+
.max_hw_heartbeat_ms = WDOG_TICKS_TO_MSECS(PM_WDOG_TIME_SET),
161162
.timeout = WDOG_TICKS_TO_SECS(PM_WDOG_TIME_SET),
162163
};
163164

0 commit comments

Comments
 (0)