linux/drivers/rtc/rtc-hym8563.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * Haoyu HYM8563 RTC driver
 *
 * Copyright (C) 2013 MundoReader S.L.
 * Author: Heiko Stuebner <[email protected]>
 *
 * based on rtc-HYM8563
 * Copyright (C) 2010 ROCKCHIP, Inc.
 */

#include <linux/module.h>
#include <linux/clk-provider.h>
#include <linux/i2c.h>
#include <linux/bcd.h>
#include <linux/rtc.h>

#define HYM8563_CTL1
#define HYM8563_CTL1_TEST
#define HYM8563_CTL1_STOP
#define HYM8563_CTL1_TESTC

#define HYM8563_CTL2
#define HYM8563_CTL2_TI_TP
#define HYM8563_CTL2_AF
#define HYM8563_CTL2_TF
#define HYM8563_CTL2_AIE
#define HYM8563_CTL2_TIE

#define HYM8563_SEC
#define HYM8563_SEC_VL
#define HYM8563_SEC_MASK

#define HYM8563_MIN
#define HYM8563_MIN_MASK

#define HYM8563_HOUR
#define HYM8563_HOUR_MASK

#define HYM8563_DAY
#define HYM8563_DAY_MASK

#define HYM8563_WEEKDAY
#define HYM8563_WEEKDAY_MASK

#define HYM8563_MONTH
#define HYM8563_MONTH_CENTURY
#define HYM8563_MONTH_MASK

#define HYM8563_YEAR

#define HYM8563_ALM_MIN
#define HYM8563_ALM_HOUR
#define HYM8563_ALM_DAY
#define HYM8563_ALM_WEEK

/* Each alarm check can be disabled by setting this bit in the register */
#define HYM8563_ALM_BIT_DISABLE

#define HYM8563_CLKOUT
#define HYM8563_CLKOUT_ENABLE
#define HYM8563_CLKOUT_32768
#define HYM8563_CLKOUT_1024
#define HYM8563_CLKOUT_32
#define HYM8563_CLKOUT_1
#define HYM8563_CLKOUT_MASK

#define HYM8563_TMR_CTL
#define HYM8563_TMR_CTL_ENABLE
#define HYM8563_TMR_CTL_4096
#define HYM8563_TMR_CTL_64
#define HYM8563_TMR_CTL_1
#define HYM8563_TMR_CTL_1_60
#define HYM8563_TMR_CTL_MASK

#define HYM8563_TMR_CNT

struct hym8563 {};

/*
 * RTC handling
 */

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

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

static int hym8563_rtc_alarm_irq_enable(struct device *dev,
					unsigned int enabled)
{
	struct i2c_client *client = to_i2c_client(dev);
	int data;

	data = i2c_smbus_read_byte_data(client, HYM8563_CTL2);
	if (data < 0)
		return data;

	if (enabled)
		data |= HYM8563_CTL2_AIE;
	else
		data &= ~HYM8563_CTL2_AIE;

	return i2c_smbus_write_byte_data(client, HYM8563_CTL2, data);
};

static int hym8563_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alm)
{}

static int hym8563_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alm)
{}

static const struct rtc_class_ops hym8563_rtc_ops =;

/*
 * Handling of the clkout
 */

#ifdef CONFIG_COMMON_CLK
#define clkout_hw_to_hym8563(_hw)

static int clkout_rates[] =;

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

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

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

static int hym8563_clkout_control(struct clk_hw *hw, bool enable)
{}

static int hym8563_clkout_prepare(struct clk_hw *hw)
{}

static void hym8563_clkout_unprepare(struct clk_hw *hw)
{}

static int hym8563_clkout_is_prepared(struct clk_hw *hw)
{}

static const struct clk_ops hym8563_clkout_ops =;

static struct clk *hym8563_clkout_register_clk(struct hym8563 *hym8563)
{}
#endif

/*
 * The alarm interrupt is implemented as a level-low interrupt in the
 * hym8563, while the timer interrupt uses a falling edge.
 * We don't use the timer at all, so the interrupt is requested to
 * use the level-low trigger.
 */
static irqreturn_t hym8563_irq(int irq, void *dev_id)
{}

static int hym8563_init_device(struct i2c_client *client)
{}

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

static int hym8563_resume(struct device *dev)
{}
#endif

static SIMPLE_DEV_PM_OPS(hym8563_pm_ops, hym8563_suspend, hym8563_resume);

static int hym8563_probe(struct i2c_client *client)
{}

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

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

static struct i2c_driver hym8563_driver =;

module_i2c_driver();

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