linux/drivers/rtc/rtc-sc27xx.c

// SPDX-License-Identifier: GPL-2.0
/*
 * Copyright (C) 2017 Spreadtrum Communications Inc.
 *
 */

#include <linux/bitops.h>
#include <linux/delay.h>
#include <linux/err.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/regmap.h>
#include <linux/rtc.h>

#define SPRD_RTC_SEC_CNT_VALUE
#define SPRD_RTC_MIN_CNT_VALUE
#define SPRD_RTC_HOUR_CNT_VALUE
#define SPRD_RTC_DAY_CNT_VALUE
#define SPRD_RTC_SEC_CNT_UPD
#define SPRD_RTC_MIN_CNT_UPD
#define SPRD_RTC_HOUR_CNT_UPD
#define SPRD_RTC_DAY_CNT_UPD
#define SPRD_RTC_SEC_ALM_UPD
#define SPRD_RTC_MIN_ALM_UPD
#define SPRD_RTC_HOUR_ALM_UPD
#define SPRD_RTC_DAY_ALM_UPD
#define SPRD_RTC_INT_EN
#define SPRD_RTC_INT_RAW_STS
#define SPRD_RTC_INT_CLR
#define SPRD_RTC_INT_MASK_STS
#define SPRD_RTC_SEC_ALM_VALUE
#define SPRD_RTC_MIN_ALM_VALUE
#define SPRD_RTC_HOUR_ALM_VALUE
#define SPRD_RTC_DAY_ALM_VALUE
#define SPRD_RTC_SPG_VALUE
#define SPRD_RTC_SPG_UPD
#define SPRD_RTC_PWR_CTRL
#define SPRD_RTC_PWR_STS
#define SPRD_RTC_SEC_AUXALM_UPD
#define SPRD_RTC_MIN_AUXALM_UPD
#define SPRD_RTC_HOUR_AUXALM_UPD
#define SPRD_RTC_DAY_AUXALM_UPD

/* BIT & MASK definition for SPRD_RTC_INT_* registers */
#define SPRD_RTC_SEC_EN
#define SPRD_RTC_MIN_EN
#define SPRD_RTC_HOUR_EN
#define SPRD_RTC_DAY_EN
#define SPRD_RTC_ALARM_EN
#define SPRD_RTC_HRS_FORMAT_EN
#define SPRD_RTC_AUXALM_EN
#define SPRD_RTC_SPG_UPD_EN
#define SPRD_RTC_SEC_UPD_EN
#define SPRD_RTC_MIN_UPD_EN
#define SPRD_RTC_HOUR_UPD_EN
#define SPRD_RTC_DAY_UPD_EN
#define SPRD_RTC_ALMSEC_UPD_EN
#define SPRD_RTC_ALMMIN_UPD_EN
#define SPRD_RTC_ALMHOUR_UPD_EN
#define SPRD_RTC_ALMDAY_UPD_EN
#define SPRD_RTC_INT_MASK

#define SPRD_RTC_TIME_INT_MASK

#define SPRD_RTC_ALMTIME_INT_MASK

#define SPRD_RTC_ALM_INT_MASK

/* second/minute/hour/day values mask definition */
#define SPRD_RTC_SEC_MASK
#define SPRD_RTC_MIN_MASK
#define SPRD_RTC_HOUR_MASK
#define SPRD_RTC_DAY_MASK

/* alarm lock definition for SPRD_RTC_SPG_UPD register */
#define SPRD_RTC_ALMLOCK_MASK
#define SPRD_RTC_ALM_UNLOCK
#define SPRD_RTC_ALM_LOCK

/* SPG values definition for SPRD_RTC_SPG_UPD register */
#define SPRD_RTC_POWEROFF_ALM_FLAG

/* power control/status definition */
#define SPRD_RTC_POWER_RESET_VALUE
#define SPRD_RTC_POWER_STS_CLEAR
#define SPRD_RTC_POWER_STS_SHIFT
#define SPRD_RTC_POWER_STS_VALID

/* timeout of synchronizing time and alarm registers (us) */
#define SPRD_RTC_POLL_TIMEOUT
#define SPRD_RTC_POLL_DELAY_US

struct sprd_rtc {};

/*
 * The Spreadtrum RTC controller has 3 groups registers, including time, normal
 * alarm and auxiliary alarm. The time group registers are used to set RTC time,
 * the normal alarm registers are used to set normal alarm, and the auxiliary
 * alarm registers are used to set auxiliary alarm. Both alarm event and
 * auxiliary alarm event can wake up system from deep sleep, but only alarm
 * event can power up system from power down status.
 */
enum sprd_rtc_reg_types {};

static int sprd_rtc_clear_alarm_ints(struct sprd_rtc *rtc)
{}

static int sprd_rtc_lock_alarm(struct sprd_rtc *rtc, bool lock)
{}

static int sprd_rtc_get_secs(struct sprd_rtc *rtc, enum sprd_rtc_reg_types type,
			     time64_t *secs)
{}

static int sprd_rtc_set_secs(struct sprd_rtc *rtc, enum sprd_rtc_reg_types type,
			     time64_t secs)
{}

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

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

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

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

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

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

static const struct rtc_class_ops sprd_rtc_ops =;

static irqreturn_t sprd_rtc_handler(int irq, void *dev_id)
{}

static int sprd_rtc_check_power_down(struct sprd_rtc *rtc)
{}

static int sprd_rtc_check_alarm_int(struct sprd_rtc *rtc)
{}

static int sprd_rtc_probe(struct platform_device *pdev)
{}

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

static struct platform_driver sprd_rtc_driver =;
module_platform_driver();

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