#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/mfd/da9052/da9052.h>
#include <linux/mfd/da9052/reg.h>
#define rtc_err(rtc, fmt, ...) \
dev_err(rtc->da9052->dev, "%s: " fmt, __func__, ##__VA_ARGS__)
#define DA9052_GET_TIME_RETRIES 5
static int da9052_rtc_enable_alarm(struct da9052_rtc *rtc, bool enable)
ret = da9052_reg_update(rtc->da9052, DA9052_ALARM_Y_REG,
DA9052_ALARM_Y_ALARM_ON|DA9052_ALARM_Y_TICK_ON,
DA9052_ALARM_Y_ALARM_ON);
rtc_err(rtc, "Failed to enable ALM: %d\n", ret);
ret = da9052_reg_update(rtc->da9052, DA9052_ALARM_Y_REG,
DA9052_ALARM_Y_ALARM_ON|DA9052_ALARM_Y_TICK_ON, 0);
rtc_err(rtc, "Write error: %d\n", ret);
static irqreturn_t da9052_rtc_irq(int irq, void *data)
struct da9052_rtc *rtc = data;
rtc_update_irq(rtc->rtc, 1, RTC_IRQF | RTC_AF);
static int da9052_read_alarm(struct da9052_rtc *rtc, struct rtc_time *rtc_tm)