drivers/watchdog/rave-sp-wdt.c
Source file repositories/reference/linux-study-clean/drivers/watchdog/rave-sp-wdt.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/watchdog/rave-sp-wdt.c- Extension
.c- Size
- 8281 bytes
- Lines
- 337
- 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.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/delay.hlinux/kernel.hlinux/mfd/rave-sp.hlinux/module.hlinux/nvmem-consumer.hlinux/of.hlinux/platform_device.hlinux/reboot.hlinux/slab.hlinux/watchdog.h
Detected Declarations
struct rave_sp_wdt_variantstruct rave_sp_wdtfunction rave_sp_wdt_execfunction rave_sp_wdt_legacy_configurefunction rave_sp_wdt_rdu_configurefunction rave_sp_wdt_configurefunction rave_sp_wdt_legacy_restartfunction rave_sp_wdt_rdu_restartfunction rave_sp_wdt_reboot_notifierfunction rave_sp_wdt_restartfunction rave_sp_wdt_startfunction rave_sp_wdt_stopfunction rave_sp_wdt_set_timeoutfunction rave_sp_wdt_pingfunction rave_sp_wdt_probe
Annotated Snippet
struct rave_sp_wdt_variant {
unsigned int max_timeout;
unsigned int min_timeout;
int (*configure)(struct watchdog_device *, bool);
int (*restart)(struct watchdog_device *);
};
/**
* struct rave_sp_wdt - RAVE SP watchdog
*
* @wdd: Underlying watchdog device
* @sp: Pointer to parent RAVE SP device
* @variant: Device specific variant information
* @reboot_notifier: Reboot notifier implementing machine reset
*/
struct rave_sp_wdt {
struct watchdog_device wdd;
struct rave_sp *sp;
const struct rave_sp_wdt_variant *variant;
struct notifier_block reboot_notifier;
};
static struct rave_sp_wdt *to_rave_sp_wdt(struct watchdog_device *wdd)
{
return container_of(wdd, struct rave_sp_wdt, wdd);
}
static int rave_sp_wdt_exec(struct watchdog_device *wdd, void *data,
size_t data_size)
{
return rave_sp_exec(to_rave_sp_wdt(wdd)->sp,
data, data_size, NULL, 0);
}
static int rave_sp_wdt_legacy_configure(struct watchdog_device *wdd, bool on)
{
u8 cmd[] = {
[0] = RAVE_SP_CMD_SW_WDT,
[1] = 0,
[2] = 0,
[3] = on,
[4] = on ? wdd->timeout : 0,
};
return rave_sp_wdt_exec(wdd, cmd, sizeof(cmd));
}
static int rave_sp_wdt_rdu_configure(struct watchdog_device *wdd, bool on)
{
u8 cmd[] = {
[0] = RAVE_SP_CMD_SW_WDT,
[1] = 0,
[2] = on,
[3] = (u8)wdd->timeout,
[4] = (u8)(wdd->timeout >> 8),
};
return rave_sp_wdt_exec(wdd, cmd, sizeof(cmd));
}
/**
* rave_sp_wdt_configure - Configure watchdog device
*
* @wdd: Device to configure
* @on: Desired state of the watchdog timer (ON/OFF)
*
* This function configures two aspects of the watchdog timer:
*
* - Wheither it is ON or OFF
* - Its timeout duration
*
* with first aspect specified via function argument and second via
* the value of 'wdd->timeout'.
*/
static int rave_sp_wdt_configure(struct watchdog_device *wdd, bool on)
{
return to_rave_sp_wdt(wdd)->variant->configure(wdd, on);
}
static int rave_sp_wdt_legacy_restart(struct watchdog_device *wdd)
{
u8 cmd[] = {
[0] = RAVE_SP_CMD_RESET,
[1] = 0,
[2] = RAVE_SP_RESET_BYTE
};
return rave_sp_wdt_exec(wdd, cmd, sizeof(cmd));
}
Annotation
- Immediate include surface: `linux/delay.h`, `linux/kernel.h`, `linux/mfd/rave-sp.h`, `linux/module.h`, `linux/nvmem-consumer.h`, `linux/of.h`, `linux/platform_device.h`, `linux/reboot.h`.
- Detected declarations: `struct rave_sp_wdt_variant`, `struct rave_sp_wdt`, `function rave_sp_wdt_exec`, `function rave_sp_wdt_legacy_configure`, `function rave_sp_wdt_rdu_configure`, `function rave_sp_wdt_configure`, `function rave_sp_wdt_legacy_restart`, `function rave_sp_wdt_rdu_restart`, `function rave_sp_wdt_reboot_notifier`, `function rave_sp_wdt_restart`.
- 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.