linux/drivers/rtc/rtc-rx6110.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * Driver for the Epson RTC module RX-6110 SA
 *
 * Copyright(C) 2015 Pengutronix, Steffen Trumtrar <[email protected]>
 * Copyright(C) SEIKO EPSON CORPORATION 2013. All rights reserved.
 */

#include <linux/bcd.h>
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/regmap.h>
#include <linux/rtc.h>
#include <linux/of.h>
#include <linux/spi/spi.h>
#include <linux/i2c.h>

/* RX-6110 Register definitions */
#define RX6110_REG_SEC
#define RX6110_REG_MIN
#define RX6110_REG_HOUR
#define RX6110_REG_WDAY
#define RX6110_REG_MDAY
#define RX6110_REG_MONTH
#define RX6110_REG_YEAR
#define RX6110_REG_RES1
#define RX6110_REG_ALMIN
#define RX6110_REG_ALHOUR
#define RX6110_REG_ALWDAY
#define RX6110_REG_TCOUNT0
#define RX6110_REG_TCOUNT1
#define RX6110_REG_EXT
#define RX6110_REG_FLAG
#define RX6110_REG_CTRL
#define RX6110_REG_USER0
#define RX6110_REG_USER1
#define RX6110_REG_USER2
#define RX6110_REG_USER3
#define RX6110_REG_USER4
#define RX6110_REG_USER5
#define RX6110_REG_USER6
#define RX6110_REG_USER7
#define RX6110_REG_USER8
#define RX6110_REG_USER9
#define RX6110_REG_USERA
#define RX6110_REG_USERB
#define RX6110_REG_USERC
#define RX6110_REG_USERD
#define RX6110_REG_USERE
#define RX6110_REG_USERF
#define RX6110_REG_RES2
#define RX6110_REG_RES3
#define RX6110_REG_IRQ

#define RX6110_BIT_ALARM_EN

/* Extension Register (1Dh) bit positions */
#define RX6110_BIT_EXT_TSEL0
#define RX6110_BIT_EXT_TSEL1
#define RX6110_BIT_EXT_TSEL2
#define RX6110_BIT_EXT_WADA
#define RX6110_BIT_EXT_TE
#define RX6110_BIT_EXT_USEL
#define RX6110_BIT_EXT_FSEL0
#define RX6110_BIT_EXT_FSEL1

/* Flag Register (1Eh) bit positions */
#define RX6110_BIT_FLAG_VLF
#define RX6110_BIT_FLAG_AF
#define RX6110_BIT_FLAG_TF
#define RX6110_BIT_FLAG_UF

/* Control Register (1Fh) bit positions */
#define RX6110_BIT_CTRL_TBKE
#define RX6110_BIT_CTRL_TBKON
#define RX6110_BIT_CTRL_TSTP
#define RX6110_BIT_CTRL_AIE
#define RX6110_BIT_CTRL_TIE
#define RX6110_BIT_CTRL_UIE
#define RX6110_BIT_CTRL_STOP
#define RX6110_BIT_CTRL_TEST

enum {};

#define RX6110_DRIVER_NAME

struct rx6110_data {};

/**
 * rx6110_rtc_tm_to_data - convert rtc_time to native time encoding
 *
 * @tm: holds date and time
 * @data: holds the encoding in rx6110 native form
 */
static int rx6110_rtc_tm_to_data(struct rtc_time *tm, u8 *data)
{}

/**
 * rx6110_data_to_rtc_tm - convert native time encoding to rtc_time
 *
 * @data: holds the encoding in rx6110 native form
 * @tm: holds date and time
 */
static int rx6110_data_to_rtc_tm(u8 *data, struct rtc_time *tm)
{}

/**
 * rx6110_set_time - set the current time in the rx6110 registers
 *
 * @dev: the rtc device in use
 * @tm: holds date and time
 *
 * BUG: The HW assumes every year that is a multiple of 4 to be a leap
 * year. Next time this is wrong is 2100, which will not be a leap year
 *
 * Note: If STOP is not set/cleared, the clock will start when the seconds
 *       register is written
 *
 */
static int rx6110_set_time(struct device *dev, struct rtc_time *tm)
{}

/**
 * rx6110_get_time - get the current time from the rx6110 registers
 * @dev: the rtc device in use
 * @tm: holds date and time
 */
static int rx6110_get_time(struct device *dev, struct rtc_time *tm)
{}

static const struct reg_sequence rx6110_default_regs[] =;

/**
 * rx6110_init - initialize the rx6110 registers
 *
 * @rx6110: pointer to the rx6110 struct in use
 *
 */
static int rx6110_init(struct rx6110_data *rx6110)
{}

static const struct rtc_class_ops rx6110_rtc_ops =;

static int rx6110_probe(struct rx6110_data *rx6110, struct device *dev)
{}

#if IS_ENABLED(CONFIG_SPI_MASTER)
static const struct regmap_config regmap_spi_config =;

/**
 * rx6110_spi_probe - initialize rtc driver
 * @spi: pointer to spi device
 */
static int rx6110_spi_probe(struct spi_device *spi)
{}

static const struct spi_device_id rx6110_spi_id[] =;
MODULE_DEVICE_TABLE(spi, rx6110_spi_id);

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

static struct spi_driver rx6110_spi_driver =;

static int rx6110_spi_register(void)
{}

static void rx6110_spi_unregister(void)
{}
#else
static int rx6110_spi_register(void)
{
	return 0;
}

static void rx6110_spi_unregister(void)
{
}
#endif /* CONFIG_SPI_MASTER */

#if IS_ENABLED(CONFIG_I2C)
static const struct regmap_config regmap_i2c_config =;

static int rx6110_i2c_probe(struct i2c_client *client)
{}

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

static const struct i2c_device_id rx6110_i2c_id[] =;
MODULE_DEVICE_TABLE(i2c, rx6110_i2c_id);

static struct i2c_driver rx6110_i2c_driver =;

static int rx6110_i2c_register(void)
{}

static void rx6110_i2c_unregister(void)
{}
#else
static int rx6110_i2c_register(void)
{
	return 0;
}

static void rx6110_i2c_unregister(void)
{
}
#endif /* CONFIG_I2C */

static int __init rx6110_module_init(void)
{}
module_init();

static void __exit rx6110_module_exit(void)
{}
module_exit(rx6110_module_exit);

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