Implement the get_timeout operation for the sandbox watchdog driver.

Signed-off-by: Juuso Rinta <[email protected]>
---
 drivers/watchdog/sandbox_wdt.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/watchdog/sandbox_wdt.c b/drivers/watchdog/sandbox_wdt.c
index cd5eadbfd21..d6e8d71843a 100644
--- a/drivers/watchdog/sandbox_wdt.c
+++ b/drivers/watchdog/sandbox_wdt.c
@@ -43,11 +43,20 @@ static int sandbox_wdt_expire_now(struct udevice *dev, 
ulong flags)
        return 0;
 }
 
+static int sandbox_wdt_get_timeout(struct udevice *dev, u64 *timeout)
+{
+       struct sandbox_state *state = state_get_current();
+
+       *timeout = state->wdt.counter;
+       return 0;
+}
+
 static const struct wdt_ops sandbox_wdt_ops = {
        .start = sandbox_wdt_start,
        .reset = sandbox_wdt_reset,
        .stop = sandbox_wdt_stop,
        .expire_now = sandbox_wdt_expire_now,
+       .get_timeout = sandbox_wdt_get_timeout,
 };
 
 static const struct udevice_id sandbox_wdt_ids[] = {

-- 
2.39.2

Reply via email to