linux/drivers/rtc/rtc-rv3032.c

// SPDX-License-Identifier: GPL-2.0
/*
 * RTC driver for the Micro Crystal RV3032
 *
 * Copyright (C) 2020 Micro Crystal SA
 *
 * Alexandre Belloni <[email protected]>
 *
 */

#include <linux/clk.h>
#include <linux/clk-provider.h>
#include <linux/bcd.h>
#include <linux/bitfield.h>
#include <linux/bitops.h>
#include <linux/hwmon.h>
#include <linux/i2c.h>
#include <linux/interrupt.h>
#include <linux/kernel.h>
#include <linux/log2.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/regmap.h>
#include <linux/rtc.h>

#define RV3032_SEC
#define RV3032_MIN
#define RV3032_HOUR
#define RV3032_WDAY
#define RV3032_DAY
#define RV3032_MONTH
#define RV3032_YEAR
#define RV3032_ALARM_MIN
#define RV3032_ALARM_HOUR
#define RV3032_ALARM_DAY
#define RV3032_STATUS
#define RV3032_TLSB
#define RV3032_TMSB
#define RV3032_CTRL1
#define RV3032_CTRL2
#define RV3032_CTRL3
#define RV3032_TS_CTRL
#define RV3032_CLK_IRQ
#define RV3032_EEPROM_ADDR
#define RV3032_EEPROM_DATA
#define RV3032_EEPROM_CMD
#define RV3032_RAM1
#define RV3032_PMU
#define RV3032_OFFSET
#define RV3032_CLKOUT1
#define RV3032_CLKOUT2
#define RV3032_TREF0
#define RV3032_TREF1

#define RV3032_STATUS_VLF
#define RV3032_STATUS_PORF
#define RV3032_STATUS_EVF
#define RV3032_STATUS_AF
#define RV3032_STATUS_TF
#define RV3032_STATUS_UF
#define RV3032_STATUS_TLF
#define RV3032_STATUS_THF

#define RV3032_TLSB_CLKF
#define RV3032_TLSB_EEBUSY
#define RV3032_TLSB_TEMP

#define RV3032_CLKOUT2_HFD_MSK
#define RV3032_CLKOUT2_FD_MSK
#define RV3032_CLKOUT2_OS

#define RV3032_CTRL1_EERD
#define RV3032_CTRL1_WADA

#define RV3032_CTRL2_STOP
#define RV3032_CTRL2_EIE
#define RV3032_CTRL2_AIE
#define RV3032_CTRL2_TIE
#define RV3032_CTRL2_UIE
#define RV3032_CTRL2_CLKIE
#define RV3032_CTRL2_TSE

#define RV3032_PMU_TCM
#define RV3032_PMU_TCR
#define RV3032_PMU_BSM
#define RV3032_PMU_NCLKE

#define RV3032_PMU_BSM_DSM
#define RV3032_PMU_BSM_LSM

#define RV3032_OFFSET_MSK

#define RV3032_EVT_CTRL_TSR

#define RV3032_EEPROM_CMD_UPDATE
#define RV3032_EEPROM_CMD_WRITE
#define RV3032_EEPROM_CMD_READ

#define RV3032_EEPROM_USER

#define RV3032_EEBUSY_POLL
#define RV3032_EEBUSY_TIMEOUT

#define OFFSET_STEP_PPT

struct rv3032_data {};

static u16 rv3032_trickle_resistors[] =;
static u16 rv3032_trickle_voltages[] =;

static int rv3032_exit_eerd(struct rv3032_data *rv3032, u32 eerd)
{}

static int rv3032_enter_eerd(struct rv3032_data *rv3032, u32 *eerd)
{}

static int rv3032_update_cfg(struct rv3032_data *rv3032, unsigned int reg,
			     unsigned int mask, unsigned int val)
{}

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

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

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

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

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

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

static int rv3032_read_offset(struct device *dev, long *offset)
{}

static int rv3032_set_offset(struct device *dev, long offset)
{}

static int rv3032_param_get(struct device *dev, struct rtc_param *param)
{}

static int rv3032_param_set(struct device *dev, struct rtc_param *param)
{}

static int rv3032_ioctl(struct device *dev, unsigned int cmd, unsigned long arg)
{}

static int rv3032_nvram_write(void *priv, unsigned int offset, void *val, size_t bytes)
{}

static int rv3032_nvram_read(void *priv, unsigned int offset, void *val, size_t bytes)
{}

static int rv3032_eeprom_write(void *priv, unsigned int offset, void *val, size_t bytes)
{}

static int rv3032_eeprom_read(void *priv, unsigned int offset, void *val, size_t bytes)
{}

static int rv3032_trickle_charger_setup(struct device *dev, struct rv3032_data *rv3032)
{}

#ifdef CONFIG_COMMON_CLK
#define clkout_hw_to_rv3032(hw)

static int clkout_xtal_rates[] =;

#define RV3032_HFD_STEP

static unsigned long rv3032_clkout_recalc_rate(struct clk_hw *hw,
					       unsigned long parent_rate)
{}

static long rv3032_clkout_round_rate(struct clk_hw *hw, unsigned long rate,
				     unsigned long *prate)
{}

static int rv3032_clkout_set_rate(struct clk_hw *hw, unsigned long rate,
				  unsigned long parent_rate)
{}

static int rv3032_clkout_prepare(struct clk_hw *hw)
{}

static void rv3032_clkout_unprepare(struct clk_hw *hw)
{}

static int rv3032_clkout_is_prepared(struct clk_hw *hw)
{}

static const struct clk_ops rv3032_clkout_ops =;

static int rv3032_clkout_register_clk(struct rv3032_data *rv3032,
				      struct i2c_client *client)
{}
#endif

static int rv3032_hwmon_read_temp(struct device *dev, long *mC)
{}

static umode_t rv3032_hwmon_is_visible(const void *data, enum hwmon_sensor_types type,
				       u32 attr, int channel)
{}

static int rv3032_hwmon_read(struct device *dev, enum hwmon_sensor_types type,
			     u32 attr, int channel, long *temp)
{}

static const struct hwmon_channel_info * const rv3032_hwmon_info[] =;

static const struct hwmon_ops rv3032_hwmon_hwmon_ops =;

static const struct hwmon_chip_info rv3032_hwmon_chip_info =;

static void rv3032_hwmon_register(struct device *dev)
{}

static const struct rtc_class_ops rv3032_rtc_ops =;

static const struct regmap_config regmap_config =;

static int rv3032_probe(struct i2c_client *client)
{}

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

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

static struct i2c_driver rv3032_driver =;
module_i2c_driver();

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