linux/drivers/rtc/rtc-pm8xxx.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * pm8xxx RTC driver
 *
 * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved.
 * Copyright (c) 2023, Linaro Limited
 */
#include <linux/of.h>
#include <linux/module.h>
#include <linux/nvmem-consumer.h>
#include <linux/init.h>
#include <linux/rtc.h>
#include <linux/platform_device.h>
#include <linux/pm.h>
#include <linux/pm_wakeirq.h>
#include <linux/regmap.h>
#include <linux/slab.h>
#include <linux/spinlock.h>

#include <linux/unaligned.h>

/* RTC_CTRL register bit fields */
#define PM8xxx_RTC_ENABLE
#define PM8xxx_RTC_ALARM_CLEAR
#define PM8xxx_RTC_ALARM_ENABLE

#define NUM_8_BIT_RTC_REGS

/**
 * struct pm8xxx_rtc_regs - describe RTC registers per PMIC versions
 * @ctrl:		address of control register
 * @write:		base address of write registers
 * @read:		base address of read registers
 * @alarm_ctrl:		address of alarm control register
 * @alarm_ctrl2:	address of alarm control2 register
 * @alarm_rw:		base address of alarm read-write registers
 * @alarm_en:		alarm enable mask
 */
struct pm8xxx_rtc_regs {};

/**
 * struct pm8xxx_rtc -  RTC driver internal structure
 * @rtc:		RTC device
 * @regmap:		regmap used to access registers
 * @allow_set_time:	whether the time can be set
 * @alarm_irq:		alarm irq number
 * @regs:		register description
 * @dev:		device structure
 * @nvmem_cell:		nvmem cell for offset
 * @offset:		offset from epoch in seconds
 */
struct pm8xxx_rtc {};

static int pm8xxx_rtc_read_nvmem_offset(struct pm8xxx_rtc *rtc_dd)
{}

static int pm8xxx_rtc_write_nvmem_offset(struct pm8xxx_rtc *rtc_dd, u32 offset)
{}

static int pm8xxx_rtc_read_offset(struct pm8xxx_rtc *rtc_dd)
{}

static int pm8xxx_rtc_read_raw(struct pm8xxx_rtc *rtc_dd, u32 *secs)
{}

static int pm8xxx_rtc_update_offset(struct pm8xxx_rtc *rtc_dd, u32 secs)
{}

/*
 * Steps to write the RTC registers.
 * 1. Disable alarm if enabled.
 * 2. Disable rtc if enabled.
 * 3. Write 0x00 to LSB.
 * 4. Write Byte[1], Byte[2], Byte[3] then Byte[0].
 * 5. Enable rtc if disabled in step 2.
 * 6. Enable alarm if disabled in step 1.
 */
static int __pm8xxx_rtc_set_time(struct pm8xxx_rtc *rtc_dd, u32 secs)
{}

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

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

static int pm8xxx_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alarm)
{}

static int pm8xxx_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alarm)
{}

static int pm8xxx_rtc_alarm_irq_enable(struct device *dev, unsigned int enable)
{}

static const struct rtc_class_ops pm8xxx_rtc_ops =;

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

static int pm8xxx_rtc_enable(struct pm8xxx_rtc *rtc_dd)
{}

static const struct pm8xxx_rtc_regs pm8921_regs =;

static const struct pm8xxx_rtc_regs pm8058_regs =;

static const struct pm8xxx_rtc_regs pm8941_regs =;

static const struct pm8xxx_rtc_regs pmk8350_regs =;

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

static int pm8xxx_rtc_probe(struct platform_device *pdev)
{}

static void pm8xxx_remove(struct platform_device *pdev)
{}

static struct platform_driver pm8xxx_rtc_driver =;

module_platform_driver();

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