History

Platform: OLPC: Move EC-specific functionality out from x86

Move the olpc-ec driver away from the X86 OLPC platform so that it could be used by the ARM based laptops too. Notably, the driver for the OLPC battery, which is also used on the ARM models, builds on this driver's interface. It is actually plaform independent: the OLPC EC commands with their argument and responses are mostly the same despite the delivery mechanism is different.

Lubomir Rintel committed 7 years ago

Commit ec9964b1 parent 2dc78635 files · +145 −137Browse files

Showing the changes to include/linux (1 of 5 files). Show all

Unified · Split

include/linux/olpc-ec.h+31−1
@@ -16,14 +16,28 @@ · 15 unmodified lines
16#define EC_SCI_QUERY 0x8416#define EC_SCI_QUERY 0x84
17#define EC_EXT_SCI_QUERY 0x8517#define EC_EXT_SCI_QUERY 0x85
18 18
19/* SCI source values */
20#define EC_SCI_SRC_EMPTY 0x00
21#define EC_SCI_SRC_GAME 0x01
22#define EC_SCI_SRC_BATTERY 0x02
23#define EC_SCI_SRC_BATSOC 0x04
24#define EC_SCI_SRC_BATERR 0x08
25#define EC_SCI_SRC_EBOOK 0x10 /* XO-1 only */
26#define EC_SCI_SRC_WLAN 0x20 /* XO-1 only */
27#define EC_SCI_SRC_ACPWR 0x40
28#define EC_SCI_SRC_BATCRIT 0x80
29#define EC_SCI_SRC_GPWAKE 0x100 /* XO-1.5 only */
30#define EC_SCI_SRC_ALL 0x1FF
31
19struct platform_device;32struct platform_device;
20 33
21struct olpc_ec_driver {34struct olpc_ec_driver {
22 int (*probe)(struct platform_device *);
23 int (*suspend)(struct platform_device *);35 int (*suspend)(struct platform_device *);
24 int (*resume)(struct platform_device *);36 int (*resume)(struct platform_device *);
25 37
26 int (*ec_cmd)(u8, u8 *, size_t, u8 *, size_t, void *);38 int (*ec_cmd)(u8, u8 *, size_t, u8 *, size_t, void *);
39
40 bool wakeup_available;
27};41};
28 42
29#ifdef CONFIG_OLPC43#ifdef CONFIG_OLPC
@@ -33,11 +47,27 @@ extern void olpc_ec_driver_register(struct olpc_ec_driver *drv, void *arg); · 3 unmodified lines
33extern int olpc_ec_cmd(u8 cmd, u8 *inbuf, size_t inlen, u8 *outbuf,47extern int olpc_ec_cmd(u8 cmd, u8 *inbuf, size_t inlen, u8 *outbuf,
34 size_t outlen);48 size_t outlen);
35 49
50extern void olpc_ec_wakeup_set(u16 value);
51extern void olpc_ec_wakeup_clear(u16 value);
52
53extern int olpc_ec_mask_write(u16 bits);
54extern int olpc_ec_sci_query(u16 *sci_value);
55
56extern bool olpc_ec_wakeup_available(void);
57
36#else58#else
37 59
38static inline int olpc_ec_cmd(u8 cmd, u8 *inbuf, size_t inlen, u8 *outbuf,60static inline int olpc_ec_cmd(u8 cmd, u8 *inbuf, size_t inlen, u8 *outbuf,
39 size_t outlen) { return -ENODEV; }61 size_t outlen) { return -ENODEV; }
40 62
63static inline void olpc_ec_wakeup_set(u16 value) { }
64static inline void olpc_ec_wakeup_clear(u16 value) { }
65
66static inline bool olpc_ec_wakeup_available(void)
67{
68 return false;
69}
70
41#endif /* CONFIG_OLPC */71#endif /* CONFIG_OLPC */
42 72
43#endif /* _LINUX_OLPC_EC_H */73#endif /* _LINUX_OLPC_EC_H */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t