xref: /linux/include/linux/scmi_imx_protocol.h (revision 3a39d672e7f48b8d6b91a09afa4b55352773b4b5)
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 enum scmi_nxp_protocol {
17 	SCMI_PROTOCOL_IMX_BBM = 0x81,
18 	SCMI_PROTOCOL_IMX_MISC = 0x84,
19 };
20 
21 struct scmi_imx_bbm_proto_ops {
22 	int (*rtc_time_set)(const struct scmi_protocol_handle *ph, u32 id,
23 			    uint64_t sec);
24 	int (*rtc_time_get)(const struct scmi_protocol_handle *ph, u32 id,
25 			    u64 *val);
26 	int (*rtc_alarm_set)(const struct scmi_protocol_handle *ph, u32 id,
27 			     bool enable, u64 sec);
28 	int (*button_get)(const struct scmi_protocol_handle *ph, u32 *state);
29 };
30 
31 enum scmi_nxp_notification_events {
32 	SCMI_EVENT_IMX_BBM_RTC = 0x0,
33 	SCMI_EVENT_IMX_BBM_BUTTON = 0x1,
34 	SCMI_EVENT_IMX_MISC_CONTROL = 0x0,
35 };
36 
37 struct scmi_imx_bbm_notif_report {
38 	bool			is_rtc;
39 	bool			is_button;
40 	ktime_t			timestamp;
41 	unsigned int		rtc_id;
42 	unsigned int		rtc_evt;
43 };
44 
45 struct scmi_imx_misc_ctrl_notify_report {
46 	ktime_t			timestamp;
47 	unsigned int		ctrl_id;
48 	unsigned int		flags;
49 };
50 
51 struct scmi_imx_misc_proto_ops {
52 	int (*misc_ctrl_set)(const struct scmi_protocol_handle *ph, u32 id,
53 			     u32 num, u32 *val);
54 	int (*misc_ctrl_get)(const struct scmi_protocol_handle *ph, u32 id,
55 			     u32 *num, u32 *val);
56 	int (*misc_ctrl_req_notify)(const struct scmi_protocol_handle *ph,
57 				    u32 ctrl_id, u32 evt_id, u32 flags);
58 };
59 #endif
60