linux/drivers/rtc/rtc-fsl-ftm-alarm.c

// SPDX-License-Identifier: GPL-2.0+
/*
 * Freescale FlexTimer Module (FTM) alarm device driver.
 *
 * Copyright 2014 Freescale Semiconductor, Inc.
 * Copyright 2019-2020 NXP
 *
 */

#include <linux/device.h>
#include <linux/err.h>
#include <linux/interrupt.h>
#include <linux/io.h>
#include <linux/platform_device.h>
#include <linux/mod_devicetable.h>
#include <linux/module.h>
#include <linux/fsl/ftm.h>
#include <linux/rtc.h>
#include <linux/time.h>
#include <linux/acpi.h>
#include <linux/pm_wakeirq.h>

#define FTM_SC_CLK(c)

/*
 * Select Fixed frequency clock (32KHz) as clock source
 * of FlexTimer Module
 */
#define FTM_SC_CLKS_FIXED_FREQ
#define FIXED_FREQ_CLK

/* Select 128 (2^7) as divider factor */
#define MAX_FREQ_DIV

/* Maximum counter value in FlexTimer's CNT registers */
#define MAX_COUNT_VAL

struct ftm_rtc {};

static inline u32 rtc_readl(struct ftm_rtc *dev, u32 reg)
{}

static inline void rtc_writel(struct ftm_rtc *dev, u32 reg, u32 val)
{}

static inline void ftm_counter_enable(struct ftm_rtc *rtc)
{}

static inline void ftm_counter_disable(struct ftm_rtc *rtc)
{}

static inline void ftm_irq_acknowledge(struct ftm_rtc *rtc)
{}

static inline void ftm_irq_enable(struct ftm_rtc *rtc)
{}

static inline void ftm_irq_disable(struct ftm_rtc *rtc)
{}

static inline void ftm_reset_counter(struct ftm_rtc *rtc)
{}

static void ftm_clean_alarm(struct ftm_rtc *rtc)
{}

static irqreturn_t ftm_rtc_alarm_interrupt(int irq, void *dev)
{}

static int ftm_rtc_alarm_irq_enable(struct device *dev,
		unsigned int enabled)
{}

/*
 * Note:
 *	The function is not really getting time from the RTC
 *	since FlexTimer is not a RTC device, but we need to
 *	get time to setup alarm, so we are using system time
 *	for now.
 */
static int ftm_rtc_read_time(struct device *dev, struct rtc_time *tm)
{}

static int ftm_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alm)
{}

/*
 * 1. Select fixed frequency clock (32KHz) as clock source;
 * 2. Select 128 (2^7) as divider factor;
 * So clock is 250 Hz (32KHz/128).
 *
 * 3. FlexTimer's CNT register is a 32bit register,
 * but the register's 16 bit as counter value,it's other 16 bit
 * is reserved.So minimum counter value is 0x0,maximum counter
 * value is 0xffff.
 * So max alarm value is 262 (65536 / 250) seconds
 */
static int ftm_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alm)
{}

static const struct rtc_class_ops ftm_rtc_ops =;

static int ftm_rtc_probe(struct platform_device *pdev)
{}

static const struct of_device_id ftm_rtc_match[] =;
MODULE_DEVICE_TABLE(of, ftm_rtc_match);

static const struct acpi_device_id ftm_imx_acpi_ids[] =;
MODULE_DEVICE_TABLE(acpi, ftm_imx_acpi_ids);

static struct platform_driver ftm_rtc_driver =;

module_platform_driver();

MODULE_DESCRIPTION();
MODULE_AUTHOR();
MODULE_LICENSE();