xref: /linux/include/linux/scmi_imx_protocol.h (revision f2ad904e923f70a80f478febf001f88dfd65a64c)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * SCMI Message Protocol driver NXP extension header
4  *
5  * Copyright 2024 NXP.
6  */
7 
8 #ifndef _LINUX_SCMI_NXP_PROTOCOL_H
9 #define _LINUX_SCMI_NXP_PROTOCOL_H
10 
11 #include <linux/bitfield.h>
12 #include <linux/device.h>
13 #include <linux/notifier.h>
14 #include <linux/types.h>
15 
16 #define	SCMI_PROTOCOL_IMX_BBM	0x81
17 #define	SCMI_PROTOCOL_IMX_MISC	0x84
18 
19 #define SCMI_IMX_VENDOR		"NXP"
20 #define SCMI_IMX_SUBVENDOR	"IMX"
21 
22 struct scmi_imx_bbm_proto_ops {
23 	int (*rtc_time_set)(const struct scmi_protocol_handle *ph, u32 id,
24 			    uint64_t sec);
25 	int (*rtc_time_get)(const struct scmi_protocol_handle *ph, u32 id,
26 			    u64 *val);
27 	int (*rtc_alarm_set)(const struct scmi_protocol_handle *ph, u32 id,
28 			     bool enable, u64 sec);
29 	int (*button_get)(const struct scmi_protocol_handle *ph, u32 *state);
30 };
31 
32 enum scmi_nxp_notification_events {
33 	SCMI_EVENT_IMX_BBM_RTC = 0x0,
34 	SCMI_EVENT_IMX_BBM_BUTTON = 0x1,
35 	SCMI_EVENT_IMX_MISC_CONTROL = 0x0,
36 };
37 
38 struct scmi_imx_bbm_notif_report {
39 	bool			is_rtc;
40 	bool			is_button;
41 	ktime_t			timestamp;
42 	unsigned int		rtc_id;
43 	unsigned int		rtc_evt;
44 };
45 
46 struct scmi_imx_misc_ctrl_notify_report {
47 	ktime_t			timestamp;
48 	unsigned int		ctrl_id;
49 	unsigned int		flags;
50 };
51 
52 struct scmi_imx_misc_proto_ops {
53 	int (*misc_ctrl_set)(const struct scmi_protocol_handle *ph, u32 id,
54 			     u32 num, u32 *val);
55 	int (*misc_ctrl_get)(const struct scmi_protocol_handle *ph, u32 id,
56 			     u32 *num, u32 *val);
57 	int (*misc_ctrl_req_notify)(const struct scmi_protocol_handle *ph,
58 				    u32 ctrl_id, u32 evt_id, u32 flags);
59 };
60 #endif
61