1 #ifndef _ASM_X86_INTEL_SCU_IPC_H_
2 #define  _ASM_X86_INTEL_SCU_IPC_H_
3 
4 #include <linux/notifier.h>
5 
6 #define IPCMSG_VRTC	0xFA	 /* Set vRTC device */
7 
8 /* Command id associated with message IPCMSG_VRTC */
9 #define IPC_CMD_VRTC_SETTIME      1 /* Set time */
10 #define IPC_CMD_VRTC_SETALARM     2 /* Set alarm */
11 
12 /* Read single register */
13 int intel_scu_ipc_ioread8(u16 addr, u8 *data);
14 
15 /* Read two sequential registers */
16 int intel_scu_ipc_ioread16(u16 addr, u16 *data);
17 
18 /* Read four sequential registers */
19 int intel_scu_ipc_ioread32(u16 addr, u32 *data);
20 
21 /* Read a vector */
22 int intel_scu_ipc_readv(u16 *addr, u8 *data, int len);
23 
24 /* Write single register */
25 int intel_scu_ipc_iowrite8(u16 addr, u8 data);
26 
27 /* Write two sequential registers */
28 int intel_scu_ipc_iowrite16(u16 addr, u16 data);
29 
30 /* Write four sequential registers */
31 int intel_scu_ipc_iowrite32(u16 addr, u32 data);
32 
33 /* Write a vector */
34 int intel_scu_ipc_writev(u16 *addr, u8 *data, int len);
35 
36 /* Update single register based on the mask */
37 int intel_scu_ipc_update_register(u16 addr, u8 data, u8 mask);
38 
39 /* Issue commands to the SCU with or without data */
40 int intel_scu_ipc_simple_command(int cmd, int sub);
41 int intel_scu_ipc_command(int cmd, int sub, u32 *in, int inlen,
42 							u32 *out, int outlen);
43 /* I2C control api */
44 int intel_scu_ipc_i2c_cntrl(u32 addr, u32 *data);
45 
46 /* Update FW version */
47 int intel_scu_ipc_fw_update(u8 *buffer, u32 length);
48 
49 extern struct blocking_notifier_head intel_scu_notifier;
50 
51 static inline void intel_scu_notifier_add(struct notifier_block *nb)
52 {
53 	blocking_notifier_chain_register(&intel_scu_notifier, nb);
54 }
55 
56 static inline void intel_scu_notifier_remove(struct notifier_block *nb)
57 {
58 	blocking_notifier_chain_unregister(&intel_scu_notifier, nb);
59 }
60 
61 static inline int intel_scu_notifier_post(unsigned long v, void *p)
62 {
63 	return blocking_notifier_call_chain(&intel_scu_notifier, v, p);
64 }
65 
66 #define		SCU_AVAILABLE		1
67 #define		SCU_DOWN		2
68 
69 #endif
70