drivers/watchdog/db8500_wdt.c
Source file repositories/reference/linux-study-clean/drivers/watchdog/db8500_wdt.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/watchdog/db8500_wdt.c- Extension
.c- Size
- 3652 bytes
- Lines
- 148
- Domain
- Driver Families
- Bucket
- drivers/watchdog
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/module.hlinux/kernel.hlinux/moduleparam.hlinux/err.hlinux/uaccess.hlinux/watchdog.hlinux/platform_device.hlinux/mfd/dbx500-prcmu.h
Detected Declarations
function db8500_wdt_startfunction db8500_wdt_stopfunction db8500_wdt_keepalivefunction db8500_wdt_set_timeoutfunction db8500_wdt_probefunction db8500_wdt_suspendfunction db8500_wdt_resume
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (C) ST-Ericsson SA 2011-2013
*
* Author: Mathieu Poirier <mathieu.poirier@linaro.org> for ST-Ericsson
* Author: Jonas Aaberg <jonas.aberg@stericsson.com> for ST-Ericsson
*/
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/moduleparam.h>
#include <linux/err.h>
#include <linux/uaccess.h>
#include <linux/watchdog.h>
#include <linux/platform_device.h>
#include <linux/mfd/dbx500-prcmu.h>
#define WATCHDOG_TIMEOUT 600 /* 10 minutes */
#define WATCHDOG_MIN 0
#define WATCHDOG_MAX28 268435 /* 28 bit resolution in ms == 268435.455 s */
static unsigned int timeout = WATCHDOG_TIMEOUT;
module_param(timeout, uint, 0);
MODULE_PARM_DESC(timeout,
"Watchdog timeout in seconds. default="
__MODULE_STRING(WATCHDOG_TIMEOUT) ".");
static bool nowayout = WATCHDOG_NOWAYOUT;
module_param(nowayout, bool, 0);
MODULE_PARM_DESC(nowayout,
"Watchdog cannot be stopped once started (default="
__MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
static int db8500_wdt_start(struct watchdog_device *wdd)
{
return prcmu_enable_a9wdog(PRCMU_WDOG_ALL);
}
static int db8500_wdt_stop(struct watchdog_device *wdd)
{
return prcmu_disable_a9wdog(PRCMU_WDOG_ALL);
}
static int db8500_wdt_keepalive(struct watchdog_device *wdd)
{
return prcmu_kick_a9wdog(PRCMU_WDOG_ALL);
}
static int db8500_wdt_set_timeout(struct watchdog_device *wdd,
unsigned int timeout)
{
db8500_wdt_stop(wdd);
prcmu_load_a9wdog(PRCMU_WDOG_ALL, timeout * 1000);
db8500_wdt_start(wdd);
return 0;
}
static const struct watchdog_info db8500_wdt_info = {
.options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE,
.identity = "DB8500 WDT",
.firmware_version = 1,
};
static const struct watchdog_ops db8500_wdt_ops = {
.owner = THIS_MODULE,
.start = db8500_wdt_start,
.stop = db8500_wdt_stop,
.ping = db8500_wdt_keepalive,
.set_timeout = db8500_wdt_set_timeout,
};
static struct watchdog_device db8500_wdt = {
.info = &db8500_wdt_info,
.ops = &db8500_wdt_ops,
.min_timeout = WATCHDOG_MIN,
.max_timeout = WATCHDOG_MAX28,
};
static int db8500_wdt_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
int ret;
timeout = 600; /* Default to 10 minutes */
db8500_wdt.parent = dev;
Annotation
- Immediate include surface: `linux/module.h`, `linux/kernel.h`, `linux/moduleparam.h`, `linux/err.h`, `linux/uaccess.h`, `linux/watchdog.h`, `linux/platform_device.h`, `linux/mfd/dbx500-prcmu.h`.
- Detected declarations: `function db8500_wdt_start`, `function db8500_wdt_stop`, `function db8500_wdt_keepalive`, `function db8500_wdt_set_timeout`, `function db8500_wdt_probe`, `function db8500_wdt_suspend`, `function db8500_wdt_resume`.
- Atlas domain: Driver Families / drivers/watchdog.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.