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.

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 664a39236e71 ("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: 664a39236e71 ("watchdog: Introduce hardware maximum heartbeat in watchdog core")
Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/20231112173251.4827-1-wahrenst@gmx.net
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>

authored by

Stefan Wahren and committed by
Wim Van Sebroeck
f33f5b1f 91c437ea

+2 -1
+2 -1
drivers/watchdog/bcm2835_wdt.c
··· 42 42 43 43 #define SECS_TO_WDOG_TICKS(x) ((x) << 16) 44 44 #define WDOG_TICKS_TO_SECS(x) ((x) >> 16) 45 + #define WDOG_TICKS_TO_MSECS(x) ((x) * 1000 >> 16) 45 46 46 47 struct bcm2835_wdt { 47 48 void __iomem *base; ··· 141 140 .info = &bcm2835_wdt_info, 142 141 .ops = &bcm2835_wdt_ops, 143 142 .min_timeout = 1, 144 - .max_timeout = WDOG_TICKS_TO_SECS(PM_WDOG_TIME_SET), 143 + .max_hw_heartbeat_ms = WDOG_TICKS_TO_MSECS(PM_WDOG_TIME_SET), 145 144 .timeout = WDOG_TICKS_TO_SECS(PM_WDOG_TIME_SET), 146 145 }; 147 146