Skip to content

Commit

Permalink
watchdog: bcm2835_wdt: Fix WDIOC_SETTIMEOUT handling
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
lategoodbye authored and pelwell committed Jan 10, 2024
1 parent 1e56389 commit c36d34b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/watchdog/bcm2835_wdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@

#define SECS_TO_WDOG_TICKS(x) ((x) << 16)
#define WDOG_TICKS_TO_SECS(x) ((x) >> 16)
#define WDOG_TICKS_TO_MSECS(x) ((x) * 1000 >> 16)

struct bcm2835_wdt {
void __iomem *base;
Expand Down Expand Up @@ -157,7 +158,7 @@ static struct watchdog_device bcm2835_wdt_wdd = {
.info = &bcm2835_wdt_info,
.ops = &bcm2835_wdt_ops,
.min_timeout = 1,
.max_timeout = WDOG_TICKS_TO_SECS(PM_WDOG_TIME_SET),
.max_hw_heartbeat_ms = WDOG_TICKS_TO_MSECS(PM_WDOG_TIME_SET),
.timeout = WDOG_TICKS_TO_SECS(PM_WDOG_TIME_SET),
};

Expand Down

0 comments on commit c36d34b

Please sign in to comment.