#define pr_fmt(fmt) …
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/spinlock.h>
#include <linux/platform_device.h>
#include <linux/log2.h>
#include <linux/pm.h>
#include <linux/of.h>
#include <linux/of_platform.h>
#ifdef CONFIG_X86
#include <asm/i8259.h>
#include <asm/processor.h>
#include <linux/dmi.h>
#endif
#include <linux/mc146818rtc.h>
#ifdef CONFIG_ACPI
static bool use_acpi_alarm;
module_param(use_acpi_alarm, bool, 0444);
static inline int cmos_use_acpi_alarm(void)
{ … }
#else
static inline int cmos_use_acpi_alarm(void)
{
return 0;
}
#endif
struct cmos_rtc { … };
#define is_valid_irq(n) …
static const char driver_name[] = …;
#define RTC_IRQMASK …
static inline int is_intr(u8 rtc_intr)
{ … }
#ifdef CONFIG_HPET_EMULATE_RTC
#include <asm/hpet.h>
#else
static inline int is_hpet_enabled(void)
{
return 0;
}
static inline int hpet_mask_rtc_irq_bit(unsigned long mask)
{
return 0;
}
static inline int hpet_set_rtc_irq_bit(unsigned long mask)
{
return 0;
}
static inline int
hpet_set_alarm_time(unsigned char hrs, unsigned char min, unsigned char sec)
{
return 0;
}
static inline int hpet_set_periodic_freq(unsigned long freq)
{
return 0;
}
static inline int hpet_rtc_dropped_irq(void)
{
return 0;
}
static inline int hpet_rtc_timer_init(void)
{
return 0;
}
extern irq_handler_t hpet_rtc_interrupt;
static inline int hpet_register_irq_handler(irq_handler_t handler)
{
return 0;
}
static inline int hpet_unregister_irq_handler(irq_handler_t handler)
{
return 0;
}
#endif
static inline int use_hpet_alarm(void)
{ … }
#ifdef RTC_PORT
#define can_bank2 …
static inline unsigned char cmos_read_bank2(unsigned char addr)
{ … }
static inline void cmos_write_bank2(unsigned char val, unsigned char addr)
{ … }
#else
#define can_bank2 …
static inline unsigned char cmos_read_bank2(unsigned char addr)
{
return 0;
}
static inline void cmos_write_bank2(unsigned char val, unsigned char addr)
{
}
#endif
static int cmos_read_time(struct device *dev, struct rtc_time *t)
{ … }
static int cmos_set_time(struct device *dev, struct rtc_time *t)
{ … }
struct cmos_read_alarm_callback_param { … };
static void cmos_read_alarm_callback(unsigned char __always_unused seconds,
void *param_in)
{ … }
static int cmos_read_alarm(struct device *dev, struct rtc_wkalrm *t)
{ … }
static void cmos_checkintr(struct cmos_rtc *cmos, unsigned char rtc_control)
{ … }
static void cmos_irq_enable(struct cmos_rtc *cmos, unsigned char mask)
{ … }
static void cmos_irq_disable(struct cmos_rtc *cmos, unsigned char mask)
{ … }
static int cmos_validate_alarm(struct device *dev, struct rtc_wkalrm *t)
{ … }
struct cmos_set_alarm_callback_param { … };
static void cmos_set_alarm_callback(unsigned char __always_unused seconds,
void *param_in)
{ … }
static int cmos_set_alarm(struct device *dev, struct rtc_wkalrm *t)
{ … }
static int cmos_alarm_irq_enable(struct device *dev, unsigned int enabled)
{ … }
#if IS_ENABLED(CONFIG_RTC_INTF_PROC)
static int cmos_procfs(struct device *dev, struct seq_file *seq)
{ … }
#else
#define cmos_procfs …
#endif
static const struct rtc_class_ops cmos_rtc_ops = …;
#define NVRAM_OFFSET …
static int cmos_nvram_read(void *priv, unsigned int off, void *val,
size_t count)
{ … }
static int cmos_nvram_write(void *priv, unsigned int off, void *val,
size_t count)
{ … }
static struct cmos_rtc cmos_rtc;
static irqreturn_t cmos_interrupt(int irq, void *p)
{ … }
#ifdef CONFIG_ACPI
#include <linux/acpi.h>
static u32 rtc_handler(void *context)
{ … }
static void acpi_rtc_event_setup(struct device *dev)
{ … }
static void acpi_rtc_event_cleanup(void)
{ … }
static void rtc_wake_on(struct device *dev)
{ … }
static void rtc_wake_off(struct device *dev)
{ … }
#ifdef CONFIG_X86
static void use_acpi_alarm_quirks(void)
{ … }
#else
static inline void use_acpi_alarm_quirks(void) { }
#endif
static void acpi_cmos_wake_setup(struct device *dev)
{ … }
static void cmos_check_acpi_rtc_status(struct device *dev,
unsigned char *rtc_control)
{ … }
#else
static inline void acpi_rtc_event_setup(struct device *dev)
{
}
static inline void acpi_rtc_event_cleanup(void)
{
}
static inline void acpi_cmos_wake_setup(struct device *dev)
{
}
static inline void cmos_check_acpi_rtc_status(struct device *dev,
unsigned char *rtc_control)
{
}
#endif
#ifdef CONFIG_PNP
#define INITSECTION
#else
#define INITSECTION …
#endif
#define SECS_PER_DAY …
#define SECS_PER_MONTH …
#define SECS_PER_YEAR …
static int INITSECTION
cmos_do_probe(struct device *dev, struct resource *ports, int rtc_irq)
{ … }
static void cmos_do_shutdown(int rtc_irq)
{ … }
static void cmos_do_remove(struct device *dev)
{ … }
static int cmos_aie_poweroff(struct device *dev)
{ … }
static int cmos_suspend(struct device *dev)
{ … }
static inline int cmos_poweroff(struct device *dev)
{ … }
static void cmos_check_wkalrm(struct device *dev)
{ … }
static int __maybe_unused cmos_resume(struct device *dev)
{ … }
static SIMPLE_DEV_PM_OPS(cmos_pm_ops, cmos_suspend, cmos_resume);
#ifdef CONFIG_PNP
#include <linux/pnp.h>
static int cmos_pnp_probe(struct pnp_dev *pnp, const struct pnp_device_id *id)
{ … }
static void cmos_pnp_remove(struct pnp_dev *pnp)
{ … }
static void cmos_pnp_shutdown(struct pnp_dev *pnp)
{ … }
static const struct pnp_device_id rtc_ids[] = …;
MODULE_DEVICE_TABLE(pnp, rtc_ids);
static struct pnp_driver cmos_pnp_driver = …;
#endif
#ifdef CONFIG_OF
static const struct of_device_id of_cmos_match[] = …;
MODULE_DEVICE_TABLE(of, of_cmos_match);
static __init void cmos_of_init(struct platform_device *pdev)
{ … }
#else
static inline void cmos_of_init(struct platform_device *pdev) {}
#endif
static int __init cmos_platform_probe(struct platform_device *pdev)
{ … }
static void cmos_platform_remove(struct platform_device *pdev)
{ … }
static void cmos_platform_shutdown(struct platform_device *pdev)
{ … }
MODULE_ALIAS(…) …;
static struct platform_driver cmos_platform_driver = …;
#ifdef CONFIG_PNP
static bool pnp_driver_registered;
#endif
static bool platform_driver_registered;
static int __init cmos_init(void)
{ … }
module_init(…) …;
static void __exit cmos_exit(void)
{ … }
module_exit(cmos_exit);
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;