linux/drivers/rtc/rtc-mt7622.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * Driver for MediaTek SoC based RTC
 *
 * Copyright (C) 2017 Sean Wang <[email protected]>
 */

#include <linux/clk.h>
#include <linux/interrupt.h>
#include <linux/io.h>
#include <linux/mod_devicetable.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/rtc.h>

#define MTK_RTC_DEV

#define MTK_RTC_PWRCHK1
#define RTC_PWRCHK1_MAGIC

#define MTK_RTC_PWRCHK2
#define RTC_PWRCHK2_MAGIC

#define MTK_RTC_KEY
#define RTC_KEY_MAGIC

#define MTK_RTC_PROT1
#define RTC_PROT1_MAGIC

#define MTK_RTC_PROT2
#define RTC_PROT2_MAGIC

#define MTK_RTC_PROT3
#define RTC_PROT3_MAGIC

#define MTK_RTC_PROT4
#define RTC_PROT4_MAGIC

#define MTK_RTC_CTL
#define RTC_RC_STOP

#define MTK_RTC_DEBNCE
#define RTC_DEBNCE_MASK

#define MTK_RTC_INT
#define RTC_INT_AL_STA

/*
 * Ranges from 0x40 to 0x78 provide RTC time setup for year, month,
 * day of month, day of week, hour, minute and second.
 */
#define MTK_RTC_TREG(_t, _f)

#define MTK_RTC_AL_CTL
#define RTC_AL_EN
#define RTC_AL_ALL

/*
 * The offset is used in the translation for the year between in struct
 * rtc_time and in hardware register MTK_RTC_TREG(x,MTK_YEA)
 */
#define MTK_RTC_TM_YR_OFFSET

/*
 * The lowest value for the valid tm_year. RTC hardware would take incorrectly
 * tm_year 100 as not a leap year and thus it is also required being excluded
 * from the valid options.
 */
#define MTK_RTC_TM_YR_L

/*
 * The most year the RTC can hold is 99 and the next to 99 in year register
 * would be wraparound to 0, for MT7622.
 */
#define MTK_RTC_HW_YR_LIMIT

/* The highest value for the valid tm_year */
#define MTK_RTC_TM_YR_H

/* Simple macro helps to check whether the hardware supports the tm_year */
#define MTK_RTC_TM_YR_VALID(_y)

/* Types of the function the RTC provides are time counter and alarm. */
enum {};

/* Indexes are used for the pointer to relevant registers in MTK_RTC_TREG */
enum {};

struct mtk_rtc {};

static void mtk_w32(struct mtk_rtc *rtc, u32 reg, u32 val)
{}

static u32 mtk_r32(struct mtk_rtc *rtc, u32 reg)
{}

static void mtk_rmw(struct mtk_rtc *rtc, u32 reg, u32 mask, u32 set)
{}

static void mtk_set(struct mtk_rtc *rtc, u32 reg, u32 val)
{}

static void mtk_clr(struct mtk_rtc *rtc, u32 reg, u32 val)
{}

static void mtk_rtc_hw_init(struct mtk_rtc *hw)
{}

static void mtk_rtc_get_alarm_or_time(struct mtk_rtc *hw, struct rtc_time *tm,
				      int time_alarm)
{}

static void mtk_rtc_set_alarm_or_time(struct mtk_rtc *hw, struct rtc_time *tm,
				      int time_alarm)
{}

static irqreturn_t mtk_rtc_alarmirq(int irq, void *id)
{}

static int mtk_rtc_gettime(struct device *dev, struct rtc_time *tm)
{}

static int mtk_rtc_settime(struct device *dev, struct rtc_time *tm)
{}

static int mtk_rtc_getalarm(struct device *dev, struct rtc_wkalrm *wkalrm)
{}

static int mtk_rtc_setalarm(struct device *dev, struct rtc_wkalrm *wkalrm)
{}

static const struct rtc_class_ops mtk_rtc_ops =;

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

static int mtk_rtc_probe(struct platform_device *pdev)
{}

static void mtk_rtc_remove(struct platform_device *pdev)
{}

#ifdef CONFIG_PM_SLEEP
static int mtk_rtc_suspend(struct device *dev)
{}

static int mtk_rtc_resume(struct device *dev)
{}

static SIMPLE_DEV_PM_OPS(mtk_rtc_pm_ops, mtk_rtc_suspend, mtk_rtc_resume);

#define MTK_RTC_PM_OPS
#else	/* CONFIG_PM */
#define MTK_RTC_PM_OPS
#endif	/* CONFIG_PM */

static struct platform_driver mtk_rtc_driver =;

module_platform_driver();

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