drivers/virtio/virtio_rtc_internal.h
Source file repositories/reference/linux-study-clean/drivers/virtio/virtio_rtc_internal.h
File Facts
- System
- Linux kernel
- Corpus path
drivers/virtio/virtio_rtc_internal.h- Extension
.h- Size
- 3265 bytes
- Lines
- 123
- Domain
- Driver Families
- Bucket
- drivers/virtio
- 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/device.hlinux/err.hlinux/ptp_clock_kernel.hlinux/types.h
Detected Declarations
struct viortc_devstruct viortc_classstruct viortc_ptp_clockfunction viortc_ptp_registerfunction viortc_ptp_unregisterfunction viortc_class_alarm
Annotated Snippet
#ifndef _VIRTIO_RTC_INTERNAL_H_
#define _VIRTIO_RTC_INTERNAL_H_
#include <linux/device.h>
#include <linux/err.h>
#include <linux/ptp_clock_kernel.h>
#include <linux/types.h>
/* driver core IFs */
struct viortc_dev;
int viortc_read(struct viortc_dev *viortc, u16 vio_clk_id, u64 *reading);
int viortc_read_cross(struct viortc_dev *viortc, u16 vio_clk_id, u8 hw_counter,
u64 *reading, u64 *cycles);
int viortc_cross_cap(struct viortc_dev *viortc, u16 vio_clk_id, u8 hw_counter,
bool *supported);
int viortc_read_alarm(struct viortc_dev *viortc, u16 vio_clk_id,
u64 *alarm_time, bool *enabled);
int viortc_set_alarm(struct viortc_dev *viortc, u16 vio_clk_id, u64 alarm_time,
bool alarm_enable);
int viortc_set_alarm_enabled(struct viortc_dev *viortc, u16 vio_clk_id,
bool alarm_enable);
struct viortc_class;
struct viortc_class *viortc_class_from_dev(struct device *dev);
/* PTP IFs */
struct viortc_ptp_clock;
#if IS_ENABLED(CONFIG_VIRTIO_RTC_PTP)
struct viortc_ptp_clock *viortc_ptp_register(struct viortc_dev *viortc,
struct device *parent_dev,
u16 vio_clk_id,
const char *ptp_clock_name);
int viortc_ptp_unregister(struct viortc_ptp_clock *vio_ptp,
struct device *parent_dev);
#else
static inline struct viortc_ptp_clock *
viortc_ptp_register(struct viortc_dev *viortc, struct device *parent_dev,
u16 vio_clk_id, const char *ptp_clock_name)
{
return NULL;
}
static inline int viortc_ptp_unregister(struct viortc_ptp_clock *vio_ptp,
struct device *parent_dev)
{
return -ENODEV;
}
#endif
/* HW counter IFs */
/**
* viortc_hw_xtstamp_params() - get HW-specific xtstamp params
* @hw_counter: virtio_rtc HW counter type
* @cs_id: clocksource id corresponding to hw_counter
*
* Gets the HW-specific xtstamp params. Returns an error if the driver cannot
* support xtstamp.
*
* Context: Process context.
* Return: Zero on success, negative error code otherwise.
*/
int viortc_hw_xtstamp_params(u8 *hw_counter, enum clocksource_ids *cs_id);
/* RTC class IFs */
#if IS_ENABLED(CONFIG_VIRTIO_RTC_CLASS)
void viortc_class_alarm(struct viortc_class *viortc_class, u16 vio_clk_id);
void viortc_class_stop(struct viortc_class *viortc_class);
int viortc_class_register(struct viortc_class *viortc_class);
struct viortc_class *viortc_class_init(struct viortc_dev *viortc,
u16 vio_clk_id, bool have_alarm,
struct device *parent_dev);
#else /* CONFIG_VIRTIO_RTC_CLASS */
static inline void viortc_class_alarm(struct viortc_class *viortc_class,
Annotation
- Immediate include surface: `linux/device.h`, `linux/err.h`, `linux/ptp_clock_kernel.h`, `linux/types.h`.
- Detected declarations: `struct viortc_dev`, `struct viortc_class`, `struct viortc_ptp_clock`, `function viortc_ptp_register`, `function viortc_ptp_unregister`, `function viortc_class_alarm`.
- Atlas domain: Driver Families / drivers/virtio.
- 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.