linux/drivers/rtc/rtc-rk808.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * RTC driver for Rockchip RK808
 *
 * Copyright (c) 2014, Fuzhou Rockchip Electronics Co., Ltd
 *
 * Author: Chris Zhong <[email protected]>
 * Author: Zhang Qing <[email protected]>
 */

#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/rtc.h>
#include <linux/bcd.h>
#include <linux/mfd/rk808.h>
#include <linux/platform_device.h>

/* RTC_CTRL_REG bitfields */
#define BIT_RTC_CTRL_REG_STOP_RTC_M

/* RK808 has a shadowed register for saving a "frozen" RTC time.
 * When user setting "GET_TIME" to 1, the time will save in this shadowed
 * register. If set "READSEL" to 1, user read rtc time register, actually
 * get the time of that moment. If we need the real time, clr this bit.
 */
#define BIT_RTC_CTRL_REG_RTC_GET_TIME
#define BIT_RTC_CTRL_REG_RTC_READSEL_M
#define BIT_RTC_INTERRUPTS_REG_IT_ALARM_M
#define RTC_STATUS_MASK

#define SECONDS_REG_MSK
#define MINUTES_REG_MAK
#define HOURS_REG_MSK
#define DAYS_REG_MSK
#define MONTHS_REG_MSK
#define YEARS_REG_MSK
#define WEEKS_REG_MSK

/* REG_SECONDS_REG through REG_YEARS_REG is how many registers? */

#define NUM_TIME_REGS
#define NUM_ALARM_REGS

struct rk_rtc_compat_reg {};

struct rk808_rtc {};

/*
 * The Rockchip calendar used by the RK808 counts November with 31 days. We use
 * these translation functions to convert its dates to/from the Gregorian
 * calendar used by the rest of the world. We arbitrarily define Jan 1st, 2016
 * as the day when both calendars were in sync, and treat all other dates
 * relative to that.
 * NOTE: Other system software (e.g. firmware) that reads the same hardware must
 * implement this exact same conversion algorithm, with the same anchor date.
 */
static time64_t nov2dec_transitions(struct rtc_time *tm)
{}

static void rockchip_to_gregorian(struct rtc_time *tm)
{}

static void gregorian_to_rockchip(struct rtc_time *tm)
{}

/* Read current time and date in RTC */
static int rk808_rtc_readtime(struct device *dev, struct rtc_time *tm)
{}

/* Set current time and date in RTC */
static int rk808_rtc_set_time(struct device *dev, struct rtc_time *tm)
{}

/* Read alarm time and date in RTC */
static int rk808_rtc_readalarm(struct device *dev, struct rtc_wkalrm *alrm)
{}

static int rk808_rtc_stop_alarm(struct rk808_rtc *rk808_rtc)
{}

static int rk808_rtc_start_alarm(struct rk808_rtc *rk808_rtc)
{}

static int rk808_rtc_setalarm(struct device *dev, struct rtc_wkalrm *alrm)
{}

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

/*
 * We will just handle setting the frequency and make use the framework for
 * reading the periodic interupts.
 *
 * @freq: Current periodic IRQ freq:
 * bit 0: every second
 * bit 1: every minute
 * bit 2: every hour
 * bit 3: every day
 */
static irqreturn_t rk808_alarm_irq(int irq, void *data)
{}

static const struct rtc_class_ops rk808_rtc_ops =;

#ifdef CONFIG_PM_SLEEP
/* Turn off the alarm if it should not be a wake source. */
static int rk808_rtc_suspend(struct device *dev)
{}

/* Enable the alarm if it should be enabled (in case it was disabled to
 * prevent use as a wake source).
 */
static int rk808_rtc_resume(struct device *dev)
{}
#endif

static SIMPLE_DEV_PM_OPS(rk808_rtc_pm_ops,
	rk808_rtc_suspend, rk808_rtc_resume);

static struct rk_rtc_compat_reg rk808_creg =;

static struct rk_rtc_compat_reg rk817_creg =;

static int rk808_rtc_probe(struct platform_device *pdev)
{}

static struct platform_driver rk808_rtc_driver =;

module_platform_driver();

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