rtc: add parameter ioctl

Add an ioctl allowing to get and set extra parameters for an RTC. For now,
only handle getting available features.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/20211018151933.76865-3-alexandre.belloni@bootlin.com
This commit is contained in:
Alexandre Belloni 2021-10-18 17:19:28 +02:00
parent 917425f71f
commit 6a8af1b656
2 changed files with 58 additions and 0 deletions

View file

@ -14,6 +14,7 @@
#include <linux/const.h>
#include <linux/ioctl.h>
#include <linux/types.h>
/*
* The struct used to pass data via the following ioctl. Similar to the
@ -66,6 +67,17 @@ struct rtc_pll_info {
long pll_clock; /* base PLL frequency */
};
struct rtc_param {
__u64 param;
union {
__u64 uvalue;
__s64 svalue;
__u64 ptr;
};
__u32 index;
__u32 __pad;
};
/*
* ioctl calls that are permitted to the /dev/rtc interface, if
* any of the RTC drivers are enabled.
@ -95,6 +107,9 @@ struct rtc_pll_info {
#define RTC_PLL_GET _IOR('p', 0x11, struct rtc_pll_info) /* Get PLL correction */
#define RTC_PLL_SET _IOW('p', 0x12, struct rtc_pll_info) /* Set PLL correction */
#define RTC_PARAM_GET _IOW('p', 0x13, struct rtc_param) /* Get parameter */
#define RTC_PARAM_SET _IOW('p', 0x14, struct rtc_param) /* Set parameter */
#define RTC_VL_DATA_INVALID _BITUL(0) /* Voltage too low, RTC data is invalid */
#define RTC_VL_BACKUP_LOW _BITUL(1) /* Backup voltage is low */
#define RTC_VL_BACKUP_EMPTY _BITUL(2) /* Backup empty or not present */
@ -118,6 +133,9 @@ struct rtc_pll_info {
#define RTC_FEATURE_UPDATE_INTERRUPT 4
#define RTC_FEATURE_CNT 5
/* parameter list */
#define RTC_PARAM_FEATURES 0
#define RTC_MAX_FREQ 8192