hc
2023-12-08 01573e231f18eb2d99162747186f59511f56b64d
kernel/include/linux/olpc-ec.h
....@@ -2,6 +2,8 @@
22 #ifndef _LINUX_OLPC_EC_H
33 #define _LINUX_OLPC_EC_H
44
5
+#include <linux/bits.h>
6
+
57 /* XO-1 EC commands */
68 #define EC_FIRMWARE_REV 0x08
79 #define EC_WRITE_SCI_MASK 0x1b
....@@ -16,28 +18,57 @@
1618 #define EC_SCI_QUERY 0x84
1719 #define EC_EXT_SCI_QUERY 0x85
1820
21
+/* SCI source values */
22
+#define EC_SCI_SRC_GAME BIT(0)
23
+#define EC_SCI_SRC_BATTERY BIT(1)
24
+#define EC_SCI_SRC_BATSOC BIT(2)
25
+#define EC_SCI_SRC_BATERR BIT(3)
26
+#define EC_SCI_SRC_EBOOK BIT(4) /* XO-1 only */
27
+#define EC_SCI_SRC_WLAN BIT(5) /* XO-1 only */
28
+#define EC_SCI_SRC_ACPWR BIT(6)
29
+#define EC_SCI_SRC_BATCRIT BIT(7)
30
+#define EC_SCI_SRC_GPWAKE BIT(8) /* XO-1.5 only */
31
+#define EC_SCI_SRC_ALL GENMASK(8, 0)
32
+
1933 struct platform_device;
2034
2135 struct olpc_ec_driver {
22
- int (*probe)(struct platform_device *);
2336 int (*suspend)(struct platform_device *);
2437 int (*resume)(struct platform_device *);
2538
2639 int (*ec_cmd)(u8, u8 *, size_t, u8 *, size_t, void *);
40
+
41
+ bool wakeup_available;
2742 };
2843
29
-#ifdef CONFIG_OLPC
44
+#ifdef CONFIG_OLPC_EC
3045
3146 extern void olpc_ec_driver_register(struct olpc_ec_driver *drv, void *arg);
3247
3348 extern int olpc_ec_cmd(u8 cmd, u8 *inbuf, size_t inlen, u8 *outbuf,
3449 size_t outlen);
3550
51
+extern void olpc_ec_wakeup_set(u16 value);
52
+extern void olpc_ec_wakeup_clear(u16 value);
53
+
54
+extern int olpc_ec_mask_write(u16 bits);
55
+extern int olpc_ec_sci_query(u16 *sci_value);
56
+
57
+extern bool olpc_ec_wakeup_available(void);
58
+
3659 #else
3760
3861 static inline int olpc_ec_cmd(u8 cmd, u8 *inbuf, size_t inlen, u8 *outbuf,
3962 size_t outlen) { return -ENODEV; }
4063
41
-#endif /* CONFIG_OLPC */
64
+static inline void olpc_ec_wakeup_set(u16 value) { }
65
+static inline void olpc_ec_wakeup_clear(u16 value) { }
66
+
67
+static inline bool olpc_ec_wakeup_available(void)
68
+{
69
+ return false;
70
+}
71
+
72
+#endif /* CONFIG_OLPC_EC */
4273
4374 #endif /* _LINUX_OLPC_EC_H */